Android Question Exiting App Warnings

Eric McDonald

Member
Licensed User
I was wondering if there is a way to ensure a user actually wants to leave an app. For instance, I figured out the back button using KeyCodes. However, it seems that this is not available for either the home or the overview buttons.

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode = KeyCodes.KEYCODE_BACK Then
        Select Msgbox2Async("Are you sure you want to exit?","WARNING","Yes","No","",Null,False)
            Case DialogResponse.POSITIVE
                Activity.Finish
            Case Else
                Return True
        End Select   
    End If
End Sub

I then checked this page to see if I could find anything.

Views (Core)

It appears that message boxes cannot exist within the Activity_Pause Sub, so that (I assume) would not work.

I'm hoping I'm missing something obvious, so this might be an easy question.

Any help would be much appreciated, thanks!
 

KZero

Active Member
Licensed User
Longtime User
you can't do that in android, you only can handle the back button.

if you want to make an app which the user can't exit search for "Kiosk"
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top