Android Question B4XView - SetBitmap - B4XBitmap

LucaMs

Expert
Licensed User
Longtime User
A little bit of confusion.

If I have a B4XView, its SetBitmap property (method) should require a B4XBitmap (ALSO because otherwise I don't know what I could do with a B4XBitmap), instead of:

1606149508192.png
 

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
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)

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
Top