Android Question B4XView - SetBitmap - B4XBitmap

Mahares

Expert
Licensed User
Longtime User
f I have a B4XView, its SetBitmap property (method) should require a B4XBitmap
You can still use B4XBitmap:
B4X:
Private ImageView1 As B4XView
Dim b As B4XBitmap=LoadBitmapResize(File.DirAssets,"hannibal.jpg", 50dip, 50dip, True)  'resizes the image
    ImageView1.setbitmap(b)

B4X:
Private ImageView1 As ImageView
Dim b As Bitmap=LoadBitmapResize(File.DirAssets,"hannibal.jpg", 50dip, 50dip, True)  'fits the image
    ImageView1.Bitmap = b
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User

Although it was not clearly explained in the contextual help, I had tried and got an error. I hadn't read the error message right and thought the "empirical" attempt failed because of the type.
Instead, the problem was a null object returned by:
B4X:
Dim xBmp As B4XBitmap = xLbl.GetBitmap
where xLbl is a B4XView "containing" a B4A Label.
Using xLbl.Snapshot solved the problem.


However, I still think that B4XView.SetBitmap should require a B4XBitmap (and the contextual help should be modified anyway).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…