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:

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
End Sub

Sub B4XPage_Appear

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

Sub Load_Layout '(iButtonToClick As Int)
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.



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