Popup a small confirm msgbox when Pressing Back Key

sally3599

Member
Licensed User
Longtime User
when Pressing Back Key, how to show a small confirm box with OK and Cancel? press OK to exit app and press Cancel to do nothing.

Any help will be appreciate it.
 

spillo3d96

Member
Licensed User
Longtime User
I use this:

If KeyCode=KeyCodes.KEYCODE_BACK Then

Select Msgbox2("Do you want exit app?","WARNING","Yes","","No",Null)
Case DialogResponse.POSITIVE
Activity.Finish
Case Else
Return True
End Select
 
Upvote 0

sally3599

Member
Licensed User
Longtime User
it works

Thanks spillo3d96!

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
  If KeyCode = KeyCodes.KEYCODE_BACK Then

   
Select Msgbox2("Do you want exit app?","WARNING","Yes","","No",Null)
   Case DialogResponse.POSITIVE
        Activity.Finish
   Case Else
        Return True
End Select
   

  End If
End Sub
 
Upvote 0
Top