Android Question [BX] B4XPages - Pause and Resume in B4A

Status
Not open for further replies.

agraham

Expert
Licensed User
Longtime User
For B4A the single activity Pause and Resume events appear to map on to the B4XPage_Disappear and B4XPage_Appear events which are also raised during transitions between pages. The two uses don't appear equivalent to me and I wonder if, as well as mapping to these to events, there should not be an extra two B4XPage events for these. Particularly for Pause, as identifying when the Activity might be killed would allow critical data to be saved. B4J (and maybe B4i - I don't know B4i at all) might also benefit from an event that indicated the imminent ending of the app process.
 

Oke

Member
Licensed User
Longtime User
I have a feeling that someone has already thought about this use case :)

Use B4XPage_Background / Foreground.

The Background event is the place to save anything you want. It is raised on all pages that implement the events.
Can I get an example in code?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Can I get an example in code?
1
This is an OLD THREAD! Posting another queston is a mistake.

2
B4X:
'Called when the app moved to the foreground
Sub B4XPage_Foreground   
    LogColor("B4XPage_Foreground", Colors.Yellow)
End Sub

'Called when the app is moved to the background
Sub B4XPage_Background   
    LogColor("B4XPage_Background", Colors.Yellow)
End Sub

'Called whenever a visible page disappear (pause)   
Sub B4XPage_Disappear   
    LogColor("B4XPage_Disappear", Colors.Cyan)
End Sub

'Called whenever the page becomes visible (resume)
Sub B4XPage_Appear   
    LogColor("B4XPage_Appear", Colors.Cyan)
End Sub
 
Upvote 0
Status
Not open for further replies.
Top