Other B4XPages - accessing pages


Licensed User
This is meant to be a suggestion, almost a trick; I don't know where I should write it.

The method to obtain a reference to a B4XPage is:
Dim Page As clsMyPage = B4XPages.GetPage("PageId")
As you can see in the ThreePagesExample project, the two "extra" pages, Page2 and Page3, are declared as Global Public, initialized and added to B4XPages in the B4XMainPage. By doing this, you will be able to access each page much more easily by writing:
without the need to create a new variable (Dim Page, above), without having to remember the page Id string, avoiding to use literals and without the risk of writing it wrong.


Using the first method, however, it will be possible to use a variable as page identifier, which in some cases could be useful/necessary.

[I know, this may seem to be very obvious but not for everyone]
Last edited: