B4J Question [Solved]How to use BC.SetBitmapToImageView() with B4XImageView

Theera

Expert
Licensed User
Longtime User
After select to use B4XImageView instead of ImageView for Gravity. I 've error message as belows. How to code be correct?
B4X:
'BC.SetBitmapToImageView(BC.Bitmap, ImageView1) --> OK  for as B4XView

BC.SetBitmapToImageView(BC.Bitmap,B4XImageView1.Bitmap.As(B4XView))   ---> Not OK for as B4XImageView

main._appstart (java line: 61)
java.lang.RuntimeException: Object should first be initialized (B4XBitmap).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:49)
at anywheresoftware.b4a.objects.B4XViewWrapper$B4XBitmapWrapper.getWidth(B4XViewWrapper.java:817)
at b4j.example.main._appstart(main.java:61)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
at java.base/java.lang.Thread.run(Thread.java:1589)
 

Attachments

  • jCircleWithRounded.zip
    2.5 KB · Views: 36
Solution
After select to use B4XImageView instead of ImageView for Gravity. I 've error message as belows. How to code be correct?
B4X:
'BC.SetBitmapToImageView(BC.Bitmap, ImageView1) --> OK  for as B4XView

BC.SetBitmapToImageView(BC.Bitmap,B4XImageView1.Bitmap.As(B4XView))   ---> Not OK for as B4XImageView
You can't use SetBitmapToImageView to B4XImageView.
Just need to do it like this
B4X:
B4XImageView1.Bitmap=BC.Bitmap

teddybear

Well-Known Member
Licensed User
After select to use B4XImageView instead of ImageView for Gravity. I 've error message as belows. How to code be correct?
B4X:
'BC.SetBitmapToImageView(BC.Bitmap, ImageView1) --> OK  for as B4XView

BC.SetBitmapToImageView(BC.Bitmap,B4XImageView1.Bitmap.As(B4XView))   ---> Not OK for as B4XImageView
You can't use SetBitmapToImageView to B4XImageView.
Just need to do it like this
B4X:
B4XImageView1.Bitmap=BC.Bitmap
 

Attachments

  • jCircleWithRounded.zip
    2.5 KB · Views: 45
Upvote 0
Solution

Theera

Expert
Licensed User
Longtime User
You can't use SetBitmapToImageView to B4XImageView.
Just need to do it like this
B4X:
B4XImageView1.Bitmap=BC.Bitmap
Many thanks, Teddybear
 
Upvote 0
Top