Yayou49 Active Member Licensed User Jul 20, 2016 #1 Hy ! On a layout, I have 1 button (BT) with one bitmap drawable (.png file). On a list (Lst), with AddTwoLinesAndBitmap2, I would like to add an icon according to icon of button (BT). I've tried something like this: Code: Dim Image As Bitmap Image = Bt.Background Lst.AddTwoLinesAndBitmap2("Text1","Text2",Image,1) Unfortunately, it doesn't work .... I've got the error: "incompatible types: Drawable cannot be converted to Bitmap" Click to expand... I've tried to declare image as BitmapDrawable but still again : "incompatible types: BitmapDrawable cannot be converted to Bitmap" Click to expand... I think Bt.Background cannot be use as I think .... But, how to get an image not directly stored on the device but coming from the layout ? Any suggestions ??? Thanks in advance.
Hy ! On a layout, I have 1 button (BT) with one bitmap drawable (.png file). On a list (Lst), with AddTwoLinesAndBitmap2, I would like to add an icon according to icon of button (BT). I've tried something like this: Code: Dim Image As Bitmap Image = Bt.Background Lst.AddTwoLinesAndBitmap2("Text1","Text2",Image,1) Unfortunately, it doesn't work .... I've got the error: "incompatible types: Drawable cannot be converted to Bitmap" Click to expand... I've tried to declare image as BitmapDrawable but still again : "incompatible types: BitmapDrawable cannot be converted to Bitmap" Click to expand... I think Bt.Background cannot be use as I think .... But, how to get an image not directly stored on the device but coming from the layout ? Any suggestions ??? Thanks in advance.
klaus Expert Licensed User Longtime User Jul 20, 2016 #2 Try this: Code: Dim Image As BitmapDrawable Image = Bt.Background Lst.AddTwoLinesAndBitmap2("Text1", "Text2", Image.Bitmap, 1) Not tested. Upvote 0
Try this: Code: Dim Image As BitmapDrawable Image = Bt.Background Lst.AddTwoLinesAndBitmap2("Text1", "Text2", Image.Bitmap, 1) Not tested.
Yayou49 Active Member Licensed User Jul 20, 2016 #3 Idea was good, but .... CastException: android.graphics.drawable.StateListDrawable cannot be cast to android.graphics.drawable.BitmapDrawable Click to expand... Anyway, I found another trick to do what I need Neverless,thanks for your answer. Instead of an object button, I took an object Image (Im) and then: Code: Dim Image As Bitmap Image = Im.Bitmap Lst.AddTwoLinesAndBitmap2("Text1","Text2",Image,1) It works fine !!!! Upvote 0
Idea was good, but .... CastException: android.graphics.drawable.StateListDrawable cannot be cast to android.graphics.drawable.BitmapDrawable Click to expand... Anyway, I found another trick to do what I need Neverless,thanks for your answer. Instead of an object button, I took an object Image (Im) and then: Code: Dim Image As Bitmap Image = Im.Bitmap Lst.AddTwoLinesAndBitmap2("Text1","Text2",Image,1) It works fine !!!!