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:
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
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).
There is a technical nuance here. The method accepts the native unwrapped type which is android.graphics.Bitmap. Any wrapper of android.graphics.Bitmap will work, including Bitmap and B4XBitmap.
There is a technical nuance here. The method accepts the native unwrapped type which is android.graphics.Bitmap. Any wrapper of android.graphics.Bitmap will work, including Bitmap and B4XBitmap.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.