Android Question [SOLVED] [B4XPages] Remove page from Stack

makis_best

Well-Known Member
Licensed User
Longtime User
Hi

If I have load in my project 5 pages in my stack and i want to disappear the third page.
How I can do it?

Thank you.
 

Mahares

Expert
Licensed User
Longtime User
Declare as public your pages in B4XMainPage
Hi Luca: I think you can do either one of these methods below without declaring the page object as public. I am checking with you because you have become a powerhouse to be reckoned with in B4XPages.
B4X:
B4XPages.ClosePage(B4XPages.MainPage.MyThirdPage)
or:
B4X:
B4XPages.ClosePage(MyThirdPage)
Knowing you get by with little sleep, you do not need to rush to answer. This can wait till tomorrow.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Of course you can close that page like that:
B4XPages.ClosePage(MyThirdPage)
but from within the B4XMainPage only. By declaring the pages public, as mentioned previously, you can manage them (even close them, as in this case) from within any other page that is not the B4XMainPage.

They, the B4XPages, are simply objects like any other; if in a module they are declared public, they will be accessible from anywhere in the project.
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Yes...
from B4XMainPage
not from another page.

Example: I have the B4XMainPage and 3 other: Pag1, Pag2, Pag3.
If I declare them Private in B4XMainPage, I cannot write, within Pag2:
B4X:
B4XPages.ClosePage(B4XPages.MainPage.Pag1)
of course, because Pag1 is not public.

Note: writing simply "Dim" in Class_Globals it is implicitly Public, but I never write "Dim" there, only inside routines.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
As the pages instances are regular class instances, there are many ways to access the pages.

The two most common ways are:
- Declare them as public variables:
B4X:
B4XPages.ClosePage(B4XPages.MainPage.Pag1)
- Use B4XPages.GetPage:
B4X:
B4XPages.ClosePage(B4XPages.GetPage("Page 3 id"))
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…