a way to get the exit application event

fabero

Member
Licensed User
Longtime User
I use

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
Msgbox(Keycode,"")
    If KeyCode = KeyCodes.KEYCODE_BACK Then
        If Msgbox2("Uscire dal programma?", "", "Si", "", "No", Null) = DialogResponse.POSITIVE Then
            Return False
        Else
            Return True
        End If
    End If
End Sub

I know that Home is not possible to intercept, but there is a way to catch the exiting of application?

Something like an "Activity_Exit"..

I try but doesn't work..
 

fabero

Member
Licensed User
Longtime User
Not sure what you mean. If the user presses on the home screen, or on the back key, or starts a new application then Activity_Pause will be called.

Ok I understand when Pause will be called. I was wrong. I Supposed that the event is raised when the app is not working.

Tnx a lot as usual.
 
Upvote 0

fabero

Member
Licensed User
Longtime User
Note that the log should show you when each of the Activiy events are called. It can be useful, especially when working with multiple activities.
So if called my Activity "JOE", i see JOE in logs? I'm right?
 
Upvote 0
Top