Android Question B4XPages.GetManager.mStackOfPageIds

RB Smissaert

Well-Known Member
Licensed User
Longtime User
I understand that this returns an ordered B4XSet with the current stack of pages, but I wonder what exactly "current stack of pages" means.
If a page is closed by pressing the Android < button then that page doesn't show in the above list, but it must exist in some form as I don't
have to load the layout of that page again before showing the page again.
I have my own way of keeping track of pages that have been shown. In the page class:

B4X:
Sub Class_Globals
    Private Root As B4XView 'ignore
    Private xui As XUI 'ignore
    Private cMP As B4XMainPage
    Private Const iPageCode As Int = 27
End Sub

Public Sub Initialize As Object
    cMP = B4XPages.GetPage("mainpage")
    Return Me
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    
    Root = Root1
    Load_Layout
    
End Sub

Sub B4XPage_Appear

    cMP.mapB4XPages.Put(iPageCode, 1)
    
End Sub

Sub Load_Layout '(iButtonToClick As Int)
    
    Root.LoadLayout(Enums.arrB4XPagesNames(iPageCode))
    AddMenuBar
    AddOverflowPanels
    
End Sub

And that works all fine, but just wonder if I am duplicating something that is already in B4XPages
and also how one could use B4XPages.GetManager.mStackOfPageIds.

RBS
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
mStackOfPageIds tracks the current stack of pages. The page at the top of the stack is the currently visible page. If you close the top page, it will be removed from the stack and the next page will become the visible page.
It doesn't track the already created pages.

Why do you need to track which pages were already created?
 
Upvote 0
Top