Android Question ACToolBarLight Creation in Class

mmieher

Active Member
Licensed User
I am trying to move my ACToolBarLight stuff to a class, because I am implementing multiple Activities in a project.

Trying to add an icon to the ToolBar.

I need to do something like this from the Class module:
B4X:
#If Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
    if (processBA.subExists("activity_createmenu")) {
        processBA.raiseEvent2(null, true, "activity_createmenu", false, new      de.amberhome.objects.appcompat.ACMenuWrapper(menu));
        return true;
    }
    else
        return false;
}
#End If

Sub Activity_CreateMenu(Menu As ACMenu)
   
    Menu.Clear
   
    '    Screenshot Icon
    shotBitMap = LoadBitmap(File.DirAssets,"monitor.png")
    ACShotItem = ACToolBarLight1.Menu.Add2(0,0,"shot",Null)
    ACShotItem.ShowAsAction = ACShotItem.SHOW_AS_ACTION_ALWAYS
    UpdateIcon("shot", AddBadgeToIcon(shotBitMap, 0))
But this will not compile, of course, since the Class module is not an Activity. I don't know very much about Java. Any ideas?
 
Top