Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Select layout
Case "NewGame"
allinvisible
MainMenu
Return True
Case "Options"
allinvisible
MainMenu
Return True
Case "GamePlay"
Dim result As Int
result = Msgbox2("Exit Game?", "Exit", "Exit", "Main Menu", "Continue playing",Null)
If result = DialogResponse.Positive Then
Msgbox(gmid,"gameid")
ExitApplication
'else if result = DialogResponse.NEGATIVE Then
'continue playing
'Return
else If result = DialogResponse.CANCEL Then
'mainmenu
allinvisible
MainMenu
Return True
End If
Case "LoadGame"
allinvisible
MainMenu
Return True
Case "Mainmenu"
ExitApplication
Case "HowtoPlay"
allinvisible
Options
Return True
Case Else
Msgbox("Need to create a backbutton for this","test")
End Select
End If
If KeyCode = KeyCodes.KEYCODE_HOME Then
Msgbox("HOME","home")
End If
End Sub