Android Question Something about bitmap(Solved)

bjfhs

Active Member
Licensed User
Longtime User
I got a bitmap in java inline ,and want to show it in a imageview.
Java
B4X:
ByteArrayInputStream bais = new ByteArrayInputStream(frameData);
Bitmap bitmap= BitmapFactory.decodeStream(bais);
processBA.raiseEventFromDifferentThread(this,null, 0,"imagerefresh",false,new Object[]{bitmap});
B4A
B4X:
Public Sub imagerefresh (img As Bitmap)
    ImageView1.Bitmap=img
  
End Sub
I get error
B4X:
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
b4a.example.main:_imagerefresh, [android.graphics.Bitmap@ea91473]
Error occurred on line: 47 (Main)
java.lang.IllegalArgumentException: method b4a.example.main._imagerefresh argument 1 has type anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper, got android.graphics.Bitmap
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$2.run(BA.java:328)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Error occurred on line: 47 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
    at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:461)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:283)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$2.run(BA.java:328)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6523)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
** Activity (main) Pause, UserClosed = true **
** Activity (main) Resume **

How can I do with it?
 

bjfhs

Active Member
Licensed User
Longtime User
What is the different between Java and B4A about Bitmap?
 
Last edited:
Upvote 0
Top