Android Question Syntax to access directly to a class prop.

luke2012

Well-Known Member
Licensed User
Longtime User
Hi All,
Instead of write this...

B4X:
Private drawBtnCancel As BitmapDrawable = xml.GetDrawable("btn_cancel")
Private btm As Bitmap = drawBtnCancel.Bitmap

Is it possible to access directly to the bitmap obj using a sintax like this ?

B4X:
Private btm As Bitmap = (xml.GetDrawable("btnCancel")).Bitmap

Thanks in advance for your reply :)
 
Last edited:

Misterbates

Active Member
Licensed User
Is it possible to access directly to the bitmap obj using a sintax like this ?
B4X:
Private btm As Bitmap = (xml.GetDrawable("btnCancel")).Bitmap

As long as xml.GetDrawable return type is a BitmapDrawable. If it isn't (e.g. if return type is an Object), then not possible, and you'll still need the drawBtnCancel variable in order to cast the result from xml.getDrawable to a BitmapDrawable type.
 
Upvote 0
Top