Android Question [SOLVED] B4XMainPage.Initialize & AppPage - how to show hamburger menu?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I understand that if you add a page in B4xMainPage.Initialize, that page will be the page shown. This is my code below?

B4X:
Public Sub Initialize
    LogColor("B4XMainPage.Initialize", xui.Color_Green)
    B4XPages.GetManager.TransitionAnimationDuration = 0
    B4XPages.GetManager.LogEvents = False
    config = ReadConfig
    Dbase = config.Get("Database")
    FBKey = config.Get("FBKey")
    '
    pgx2.Initialize
    B4XPages.AddPageAndCreate("pg2", pgx2)
    
    pgx3.Initialize
    B4XPages.AddPageAndCreate("pg3", pgx3)
    
    pgx4.Initialize
    B4XPages.AddPageAndCreate("pg4", pgx4)
    
    pgx5.Initialize
    B4XPages.AddPageAndCreate("pg5", pgx5)
End Sub

This shows the pg2 but the hamburger is hidden? I'd like to show the hamburger irrespective, how can I achieve that?

Thanks
 

Mashiane

Expert
Licensed User
Longtime User
Thought perhaps if I copy this code from b4xpage_create and paste this code to Initialize, it will work..

B4X:
HamburgerIcon = xui.LoadBitmapResize(File.DirAssets, "my.png", 32dip, 32dip, True)
B4XPages.GetManager.ActionBar.RunMethod("setDisplayHomeAsUpEnabled", Array(True))
    Dim bd As BitmapDrawable
    bd.Initialize(HamburgerIcon)
    B4XPages.GetManager.ActionBar.RunMethod("setHomeAsUpIndicator", Array(bd))

Solves the issue.
 
Upvote 0
Top