Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("game_menu")
If File.Exists(File.DirDefaultExternal, "score.db") = False Then
SQL1.Initialize(File.DirDefaultExternal, "scores.db", True)
SQL1.ExecNonQuery("DROP TABLE IF EXISTS highscore")
SQL1.ExecNonQuery("DROP TABLE IF EXISTS gamesplayed")
SQL1.ExecNonQuery("DROP TABLE IF EXISTS playername")
SQL1.ExecNonQuery("CREATE TABLE highscore (name TEXT, score INTEGER)")
SQL1.ExecNonQuery("CREATE TABLE gamesplayed (number INTEGER)")
SQL1.ExecNonQuery("CREATE TABLE playername (name TEXT)")
SQL1.ExecNonQuery2("INSERT INTO highscore VALUES(?, ?)", Array As Object ("Default", 16))
SQL1.ExecNonQuery2("INSERT INTO highscore VALUES(?, ?)", Array As Object ("Andrew", 3))
SQL1.ExecNonQuery2("INSERT INTO highscore VALUES(?, ?)", Array As Object ("Default", 0))
SQL1.ExecNonQuery2("INSERT INTO highscore VALUES(?, ?)", Array As Object ("Default", 2))
SQL1.ExecNonQuery2("INSERT INTO highscore VALUES(?, ?)", Array As Object ("Andrew", 10))
Log("Number of rows = " & SQL1.ExecQuerySingleResult("SELECT count(*) FROM highscore"))
Log("Number of rows = " & SQL1.ExecQuerySingleResult("SELECT count(*) FROM gamesplayed"))
InputName.Input = ""
InputName.Hint = "Enter Your Name"
InputName.HintColor = Colors.Cyan
playerName = DialogResponse.CANCEL
playerName = InputName.Show("Enter Your Name", "Enter Your Name", "Okay", "Cancel", "Mehbe", Null)
ToastMessageShow("Name Set! Click on your name to change it!", False)
SQL1.ExecNonQuery2("INSERT INTO playername VALUES(?)", Array As Object(playerName))
ToastMessageShow("Creating files on first run", True)
Else If File.Exists(File.DirDefaultExternal, "score.db") = True Then
ToastMessageShow("Welcome back!", False)
End If
End Sub