Android Question [Solved]Question regarding drawable resources

opus

Active Member
Licensed User
Longtime User
Hi,
I use the AndroidResources Library to supply the app with different resources.

I'm using the following to asign a bitmap-variable with a graphic resource
B4X:
   Dim mBitmap as Bitmap
   Dim BitmapDrawable1 As BitmapDrawable
   BitmapDrawable1=Main.MyResources.GetApplicationDrawable("DrawableResource")
   mBitmap=LoadBitmap(File.DirAssets,"DrawableResource.gif")
   mBitmap=BitmapDrawable1.Bitmap
I can't find solution to assign "mBitmap" with the Resource-Bitmap without initially assigning it a Bitmap from a different file. Is there a better solution?
 

opus

Active Member
Licensed User
Longtime User
Thanks for the reply, however without this line I get an error message stating the object (the Bitmap-var??) has to be initialized. The whole code is within an Initialize Routine for a custom object, "mBitmap" being one of the objects properties.

EDIT: Me stupid, it works without this line. Thanks Erel, I was trying it that way (I was thinking) for the last two days, it didn't work. Conclusion: Me.Stupid!
 
Last edited:
Upvote 0
Top