Sub Activity_KeyPress (KeyCode As Int) As Boolean
'Intercept the back action in order to avoid unwanted app exit
If KeyCode = KeyCodes.KEYCODE_BACK Then
Select Msgbox2("Exit app?", "", "Yes", "", "No", Null)
Case DialogResponse.NEGATIVE
Return True
Case DialogResponse.CANCEL
Return True
Case DialogResponse.POSITIVE
Activity.Finish
End Select
End If
End Sub