Sub activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If Msgbox2("Do you want to close the app?", "Close App","Yes","Logout","No", Null) = DialogResponse.POSITIVE Then
Activity.Finish
else if DialogResponse.CANCEL Then
Activity.LoadLayout("frmlogin")
Else
End If
Return True
End If
End Sub