<code>
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Dim Answ As Int
If KeyCode=KeyCodes.KEYCODE_BACK Then
Answ=Msgbox2("Do you want to quit the program ?","A T T E N T I O N","Yes","","No",Null)
If Answ=DialogResponse.NEGATIVE Then
Return True
Else
Activity.Finish
Return False
End If
End If
End Sub
</code>
The above code works fine.