Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
Dim result As Int
Dim bp As Bitmap
bp.Initialize(File.DirAssets, "index.jpg")
If KeyCode = 4 Then
result = Msgbox2("Back hit, exit are you sure?", "App Title", "Yes", "Cancel", "No", bp)
Select result
Case -1 ' yes hit ie., exit the app
Return False
Case -3 ' cancel hit, do nothing really, and leave the app running
Return True ' which consumes the event and doesnt exit
Case Else
Return True ' also does not exit because it consumes event
End Select
End If
End Sub