ImageView - Get its Bitmap

Jim Brown

Active Member
Licensed User
Longtime User
I seem to be stuck when it comes to retrieving the bitmap loaded into an ImageView. What is the correct method use? I just need to ascertain its Width and Height.

This method causes: NullPointer
B4X:
Dim iv as ImageView : iv.Initialize("")
iv.Bitmap=LoadBitmap(File.DirAssets,"someimage.png")
...
Dim bm As Bitmap : bm.Initialize3(iv.Bitmap)

This method causes:Object should first be initialized (Bitmap)
B4X:
Dim iv as ImageView : iv.Initialize("")
iv.Bitmap=LoadBitmap(File.DirAssets,"someimage.png")
...
Dim bm As Bitmap : bm=iv.Bitmap
 

Jim Brown

Active Member
Licensed User
Longtime User
Thanks Erel.
After much head-scratching, and commenting out lots of code, the trouble-maker turned out to be the following, which I had in a sub acting on the ImageView. Thus, the image was being removed(!)
B4X:
iv.Color=Colors.Transparent
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…