Hi ivavilagu,
maybe the problem in your code lays in a missing "Return False" before the Activity.Finish.
Anyway, since the back key causes the Activity to enter its Pause sub with UserClosed=True, why you feel the need to call Activity.Finish there?
The following should do exactly the same:
Sub Activity_KeyPress (KeyCode As Int) AsBoolean 'return true if you want to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
If Msgbox2("Do you want to exit?", "", "Yes", "", "No", Null) = DialogResponse.POSITIVE Then
Return False
Else
Return True
End If
End If
End Sub
Umberto