It might be too easy but I don't know how. I keep pressing the return button on my application - inadvertently - too many times and exit the application. I know it is no big a deal but I would like to get a warning just before I exit. Is there code to flag that I am exiting the last activity? One solution is to start with a Splash screen - which might be a good idea but I would like to avoid the trouble.
Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
If Msgbox2("Exit app?", "Confirmation", "Yes", "", "No", Null) = DialogResponse.POSITIVE Then
Activity.Finish
End If
End If
Return True
End Sub
Opps, the code above actually hide my Menu - for some odd reason - so I modified it a bit.
Sub Activity_KeyPress(KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = 4 Then ' KeyCodes.KEYCODE_BACK Then
If Msgbox2("Exit app?", "Confirmation", "Yes", "", "No", Null) = DialogResponse.POSITIVE Then
Activity.Finish
Else
Return True
End If
End If
End Sub