#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Essential Database
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
'Activity module
Sub Process_Globals
Dim MediaPlayer1 As MediaPlayer
'----------------------------Start SQLite--------------------------------------------------------------------------------------------------
Dim dbFileDir As String :dbFileDir = File.DirInternal
Dim dbFileDirEx As String :dbFileDirEx = File.DirDefaultExternal
Dim dbFileName As String :dbFileName = "xyz.db"
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim SQL1 As SQL
Dim btnIntro As Button
Dim btnAudio As Button
Dim btnIssues As Button
Dim btnProducts As Button
Dim btnDocuments As Button
Dim Panel1 As Panel
Dim Timer1 As Timer
Dim btnCS As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
File.Delete(File.DirInternal, dbFileName) ' only for testing, removes the database
'Check if the database already exists
If File.Exists(File.DirInternal, dbFileName) = False Then
'copy the default DB
File.Copy(File.DirAssets, dbFileName, File.DirInternal, dbFileName)
'if not, initialize it
SQL1.Initialize(File.DirInternal, dbFileName, True)
'and create it
'CreateDataBase
'copy the default DB
File.Copy(File.DirAssets, "edbq_lite_LOC.db", File.DirInternal, "edbq_lite_LOC.db")
Else
'if yes, initialize it
SQL1.Initialize(File.DirInternal, "edbq_lite_LOC.db", True)
End If
End If
' ---------------------------
' File.Delete(File.DirDefaultExternal, dbFileName) ' for testing
' 'Copy and Initialize database
' If File.Exists(File.DirDefaultExternal, dbFileName) = False Then
' dbFileDir = DBUtils.CopyDBFromAssets(dbFileName)
' End If
' SQL1.Initialize(dbFileDir, dbFileName, True)
' ------------------------
Activity.LoadLayout("Main") ' Loads "Main" layout file
'Msgbox(dbFileDir,"Database Path: ")
'splash screen - title screen - 3 secs___________________________________
' Panel1.Visible=True ' put panel1 visible
' Panel1.BringToFront ' if some control is visible over, forces panel1 to be in front
' Panel1.SetLayout((Activity.Width - Panel1.Width) / 2, (Activity.Height - Panel1.Height) / 2, 256dip, 256dip) ' center panel1 on the screen
' Timer1.Initialize("Timer1", 3000) ' start timer1 for 3 secs
' Timer1.Enabled=True
'end of splash screen _____________________________________________
End Sub