detecting back arrow key

drj

Member
Licensed User
Longtime User
Hi,

I am working with the tablet app.

I have one main activity that calls twenty other activities.

Once I have called an activity and using it , when I want to return to the main activity , I press that back arrow or navigation arrow (I am not sure the name) and the app returns to the main activity.

While I am in one of the called activities I want to detect that the user has pressed the back arrow navigation so I can save data to the data base before the navigation goes back to the main activity.

How does one do that? Must be some easy way?

Thanks,

Jerry
 

drj

Member
Licensed User
Longtime User
Hi I am not sure that is the solution

Hi,

I took at a look at the reference and tried the following.

Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
SaveFunctions


Else

End If

End Sub

When I put this in my and then pressed the back navigation arrow on the emulator nothing happened , in fact I put a debug on it and this code did not get executed.

I am looking for something simple - what is called when I return to my main activity via pressing this arrow. If I can detect this then I can save the data in the called activity before returning to the main. In Window 8 this is analogous to the GoBack arrow?

Jerry
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It works on mine, try using a Log Statement instead of Debug. I don't think you can interrupt the process (with modal dialogs or debug) once it's shutting down as it is when Activity_Pause is called.

B4X:
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
     SaveFunctions

    Log("Saved...")
Else

End If

End Sub
 
Last edited:
Upvote 0
Top