Android Question How do I open a database once and use it throughout the application

davepamn

Active Member
Licensed User
Longtime User
B4X:
'sqlite module
    sub process_globals
      Dim oDB As cBTDatabase
    end sub

'cBTDatabase class
sub process_globals
  dim localSQL as sql
end sub

    If sqllite.oDB.IsInitialized=False Then
        sqllite.oDB.Initialize
        sqllite.oDB.OpenDatabase(Main.Database)
    EndIf

I don't want to have to keep checking in each activity if the database is available.

Is it possible to keep the cBTDatabase class variables persistent
 
Last edited:

barx

Well-Known Member
Licensed User
Longtime User
I declare it in a code module and use it from there.
 
Upvote 0
Top