Sub Activity_KeyPress(KeyCode As Int) As Boolean
Dim Answ As Int
Dim Txt As String
If KeyCode = KeyCodes.KEYCODE_BACK Then ' Checks if the KeyCode is BackKey
Txt = "Do you really want to quit the program ?"
Answ = Msgbox2(Txt, "A T T E N T I O N", "Yes", "", "No", Null) ' MessageBox
If Answ = DialogResponse.POSITIVE Then ' If return value is Yes then
Return False ' the Event will not be consumed
Else ' we leave the program
Return True ' the Event will be consumed to avoid
End If ' leaving the program
Else
Return True ' the Event will be consumed to avoid
End If
End Sub