Android Question TitleBar MenuItem

abdo.b4a

Member
Dear All
using Activity.AddMenuItem3 i can add an icon to title bar
is there a way to remove or disable icon from Title Bar programatically ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is quite simple to update menu items with B4XPages. Example:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    Dim mi As B4AMenuItem = B4XPages.AddMenuItem(Me, "test")
    mi.AddToBar = True
    
End Sub

Sub Button1_Click
    Dim menus As List = B4XPages.GetManager.GetPageInfoFromRoot(Root).Parent.MenuItems
    menus.Clear
    'add menu items
    Dim mi As B4AMenuItem = B4XPages.AddMenuItem(Me, "test2")
    mi.AddToBar = True
    
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    ctxt.RunMethod("invalidateOptionsMenu", Null)
End Sub

Sub B4XPage_MenuClick (Tag As String)
    Log(Tag)
End Sub
 
Upvote 0

abdo.b4a

Member
When i ckeck B4XPages in Libraries Manager , i got this error massage when running the program :
------------
B4A Version: 10.0
Java Version: 11
Parsing code. Error
Error parsing program.
Error description: Unknown type: b4xmainpage
Are you missing a library reference?
Error occurred on line: 73 (B4XPages)
Public Sub MainPage As B4XMainPage

------------
and in the Log's IDE i got this massage :
Unknown type: b4xmainpage<br />Are you missing a library reference?

Is there an example about creating Menu using B4Xpages ?


Thank you very much Erel
 
Upvote 0

abdo.b4a

Member
Dear Erel,

I already learned a little about B4XPages from this video .
As i understand , B4XPages is an alternative way (Technology) of the standard default way (Activities) . by other words : when i start a new application , i have to choose : Standard activities OR B4XPages .. IS This Right ?
if this is right , is it simple to update my current project (Based on Activities) to use B4XPages ?
Thank you very very much
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…