'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim MenuItemsAll As List = B4XPages.GetManager.GetPageInfoFromRoot(Root).Parent.MenuItems
MenuItemsAll.Clear
mi = B4XPages.AddMenuItem(Me, "Change Number")
mi.AddToBar = True
mi.Bitmap = xui.LoadBitmapResize(File.DirAssets, "1.png", 64dip, 64dip, False)
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("invalidateOptionsMenu", Null)
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
Dim MenuItemsAll As List = B4XPages.GetManager.GetPageInfoFromRoot(Root).Parent.MenuItems
MenuItemsAll.Clear
mi = B4XPages.AddMenuItem(Me, "Change Number")
mi.AddToBar = True
mi.Bitmap = xui.LoadBitmapResize(File.DirAssets, "2.png", 64dip, 64dip, False)
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("invalidateOptionsMenu", Null)
End Sub