Menu item

rfresh

Well-Known Member
Licensed User
Longtime User
I'm using this code to create a menu item and it works fine. My question is, is there a way I can tell if it has already been created so I don't create it twice?

I currently have it in Activity_Create inside a FirstTime if statement. But I've discovered if I do an update to the app, when it loads in, the Menu popup no longer works. I have to do a forced close and then start it up again for the menu to be there. Am I doing this the right way?

Thanks...

B4X:
Activity.AddMenuItem2("Info","PopupMenu_Info",LoadBitmap(File.DirAssets,"info40.png"))
 

NJDude

Expert
Licensed User
Longtime User
Right:
B4X:
Sub Activity_Create(FirstTime As Boolean)

    Activity.AddMenuItem2("Info","PopupMenu_Info",LoadBitmap(File.DirAssets,"info40.png"))

End Sub

Wrong:
B4X:
Sub Activity_Create(FirstTime As Boolean)

    If FirstTime Then    

       Activity.AddMenuItem2("Info","PopupMenu_Info",LoadBitmap(File.DirAssets,"info40.png"))

    End If

End Sub
 
Upvote 0
Top