LucaMs Expert Licensed User Longtime User Nov 23, 2020 #1 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:
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:
M Mahares Expert Licensed User Longtime User Nov 23, 2020 #2 LucaMs said: f I have a B4XView, its SetBitmap property (method) should require a B4XBitmap Click to expand... You can still use B4XBitmap: Code: Private ImageView1 As B4XView Dim b As B4XBitmap=LoadBitmapResize(File.DirAssets,"hannibal.jpg", 50dip, 50dip, True) 'resizes the image ImageView1.setbitmap(b) Code: 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 said: f I have a B4XView, its SetBitmap property (method) should require a B4XBitmap Click to expand... You can still use B4XBitmap: Code: Private ImageView1 As B4XView Dim b As B4XBitmap=LoadBitmapResize(File.DirAssets,"hannibal.jpg", 50dip, 50dip, True) 'resizes the image ImageView1.setbitmap(b) Code: Private ImageView1 As ImageView Dim b As Bitmap=LoadBitmapResize(File.DirAssets,"hannibal.jpg", 50dip, 50dip, True) 'fits the image ImageView1.Bitmap = b
LucaMs Expert Licensed User Longtime User Nov 23, 2020 #3 Mahares said: 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) Click to expand... 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
Mahares said: 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) Click to expand... 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).
Erel B4X founder Staff member Licensed User Longtime User Nov 24, 2020 #4 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. Upvote 0
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.
LucaMs Expert Licensed User Longtime User Nov 24, 2020 #5 Erel said: 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. Click to expand... Yes, now I understand why it is a method and not a property. Anyway, it's worth writing it in contextual help. Upvote 0
Erel said: 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. Click to expand... Yes, now I understand why it is a method and not a property. Anyway, it's worth writing it in contextual help.