Jim Brown Active Member Licensed User Longtime User Jun 27, 2013 #1 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 Code: Copy 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) Code: Copy Dim iv as ImageView : iv.Initialize("") iv.Bitmap=LoadBitmap(File.DirAssets,"someimage.png") ... Dim bm As Bitmap : bm=iv.Bitmap
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 Code: Copy 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) Code: Copy Dim iv as ImageView : iv.Initialize("") iv.Bitmap=LoadBitmap(File.DirAssets,"someimage.png") ... Dim bm As Bitmap : bm=iv.Bitmap
Erel B4X founder Staff member Licensed User Longtime User Jun 27, 2013 #2 Both options should work. Though the second one is better. Can you post the full code? Upvote 0
Jim Brown Active Member Licensed User Longtime User Jun 27, 2013 #3 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(!) Code: Copy iv.Color=Colors.Transparent Upvote 0
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(!) Code: Copy iv.Color=Colors.Transparent