Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
HandleBackKey
Return True
End If
Return False
End Sub
Private Sub HandleBackKey
Confirm(Me, "Close?")
Wait For Confirm_Result(Result As Boolean)
If Result Then Activity.Finish
End Sub
Public Sub Confirm(Callback As Object, Message As String)
Msgbox2Async(Message, "Music Machine", "Yes", "No", "", Null, False)
Wait For MsgBox_Result (iResult As Int)
CallSubDelayed2(Callback, "Confirm_Result", iResult = DialogResponse.POSITIVE)
End Sub