Not got this working yet and getting this error:
Error occurred on line: 18 (BitmapCreatorEffects)
java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.BALayout anywheresoftware.b4a.BA.vg' on a null object reference
at anywheresoftware.b4a.BA.<init>(BA.java:92)
at b4a.example.bitmapcreator.innerInitialize(bitmapcreator.java:13)
at b4a.example.bitmapcreator._initialize(bitmapcreator.java:1212)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:783)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:363)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.sqlitelight1.main.afterFirstLayout(main.java:104)
at b4a.sqlitelight1.main.access$000(main.java:17)
at b4a.sqlitelight1.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Happening here in the BitmapCreatorEffects class:
Private Sub CreateBC(bmp As B4XBitmap) As BitmapCreator
Dim bc As BitmapCreator
bc.Initialize(bmp.Width / bmp.Scale, bmp.Height / bmp.Scale) '<<<< error here
bc.CopyPixelsFromBitmap(bmp)
Return bc
End Sub
I have the latest version (3.50) of BitmapCreator in the internal libraries folder and the library is ticked.
This is the code that runs ReplaceColor:
[/CODE]
Sub BitmapDrawableFromFile(strFolder As String, strFile As String, iOldColour As Int, iNewColour As Int) As BitmapDrawable
Dim bmp As Bitmap 'also tried B4XBitmap
Dim bmpd As BitmapDrawable
bmp = LoadBitmap(strFolder, strFile)
If iOldColour <> iNewColour Then
bmp = BCE.ReplaceColor(bmp, iOldColour, iNewColour, True)
End If
bmpd.Initialize(bmp)
Return bmpd
End Sub
[/CODE]
Any idea what the problem is here?
RBS