Android Question B4XPages ShowPageAndRemovePreviousPages

_mandy

New Member
Hello, first post in any forums.

So basically I have a global variable of sql on B4XMainPage class, my idea is that once the application opens, the sql database is loaded in public and can be called by different classes upon their initialization. This is so I could prevent it from locking somehow. In my app, the B4XMainPage will house the Login page, then the SecondPage is the actual "Main Page"

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Public sql1 As SQL
    
    Dim pageSecond As SecondPage
End Sub

My question now is what happens to the B4XMainPage's public variables when i call B4XPages.ShowPageAndRemovePreviousPages("second page"). Do those get destroyed later on?
Thanks and more power!
 

LucaMs

Expert
Licensed User
Longtime User
Do those get destroyed later on?
No.

So basically I have a global variable of sql on B4XMainPage class, my idea is that once the application opens, the sql database is loaded in public and can be called by different classes upon their initialization.
Good solution, although a specific database management class would be even better.
You could create a public instance (= object = variable) of this class in the B4XMainPage or in a code module.
 
Upvote 2
Top