Android Question Drawer View menu items?

techknight

Well-Known Member
Licensed User
Longtime User
How do I add menu item icons in the right side of the actionbar/drawer view example?

Using B4XDrawer, the hamburger menu is on the left and it works fine.

But I need to put my dynamically changeable icons back on the right.

This is what I was using with the stock actionbar:

B4X:
Sub SetMenuItems(ConnectionStatus As Boolean)
    Dim Obj1 As Reflector
    Obj1.Target = Obj1.GetActivity
    Obj1.SetField2("menuItems", Null)  
    Select Case ConnectionStatus
        Case True
            Activity.AddMenuItem3("Connect", "mnuConnection", LoadBitmap(File.DirAssets, "power-green.png"), True)
        Case False
            Activity.AddMenuItem3("Connect", "mnuConnection", LoadBitmap(File.DirAssets, "power-red.png"), True)      
    End Select
    Activity.AddMenuItem3("Clear Board", "mnuClear", LoadBitmap(File.DirAssets, "trash.png"), True)
'    Activity.AddMenuItem3("Set Clock", "mnuSetClock", LoadBitmap(File.DirAssets, "stopwatch.png"), True)
'    Activity.AddMenuItem3("Time Of Day", "mnuTimeOfDay", LoadBitmap(File.DirAssets, "clock.png"), True)  
    Obj1.RunMethod("invalidateOptionsMenu")
End Sub

How do I make this work with the B4XDrawer example?

Some of the above I can probably replace with FontAwesome, I created this routine before that existed.
 

techknight

Well-Known Member
Licensed User
Longtime User
Well I never used AppCompat before, so I didn't know. I figured it was all the same thing, but guess not.

Anyways, I ended up figuring that part out, but now I have a new problem.
 
Upvote 0
Top