Android Question How to set Actionbar Home Icon (Hamburger Menu) with AppCompat

mcqueccu

Well-Known Member
Licensed User
Longtime User
I have been trying to set home icon for the past 5 hours but making no headway. If declare as Bitmap or BitmapDrawable it gives me same error - Incompatible types (bitmap to bitmap drawable). Whats the correct way to display home icon

B4X:
Dim bar As ACActionBar
Dim bp as Bitmap
'Dim bp as BitmapDrawable

'bp.Initialize(LoadBitmap(File.DirAssets,"homeicon.png"))
 bp.Initialize(File.DirAssets,"homeicon.png")

bar.initialize
bar.HomeVisible = True
bar.icon = bp

This is the Error I kept getting


java:356: error: incompatible types: Bitmap cannot be converted to Drawable
mostCurrent._bar.setIcon((android.graphics.drawable.Drawable)(mostCurrent._bp.getBitmap()));
 
Top