Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
Dim RowNumber As Int
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.
Private btnShowFiles As Button
Private SpinnerCourses As Spinner
Private SpinnerMap As Map
Private CourseID As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
Dim filelist As List
filelist.Initialize
filelist = File.ListFiles(File.DirAssets) '<---------- get a list of all included files
For i = 0 To filelist.Size-1
Log(filelist.Get(i)) ' <------------------------------log filenames
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnShowFiles_Click
SQL1.Initialize(File.DirAssets, "escscore.db", True) '<------- initialize the database and
Dim Row As Int
Dim Cursor1 As Cursor
SpinnerMap.Initialize
SpinnerCourses.Clear
Cursor1 = SQL1.ExecQuery("SELECT ID,CourseName FROM Courses") '<--- get name and id from db table
If Cursor1.RowCount > 0 Then
RowNumber=Cursor1.RowCount
For Row = 0 To RowNumber - 1
Cursor1.Position=Row
SpinnerCourses.Add(Cursor1.GetString("CourseName"))
SpinnerMap.Put(Cursor1.GetString("CourseName"),Cursor1.GetInt("ID"))
Next
End If
Cursor1.Close
End Sub
Sub SpinnerCourses_ItemClick (Position As Int, Value As Object)
CourseID=SpinnerMap.Values
ToastMessageShow(CourseID,True)
End Sub