Android Question B4XPages - ispaused

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello,

in Android it's possible to know if an Activity is visible using ispaused("ActivityName"). What´s the similar command in B4XPages? I really didn't find in the forum...
Sorry the simple question but I really didn't find.

Thanks!
 

jahswant

Well-Known Member
Licensed User
Longtime User
B4XPages are never paused. You can create a boolean variable IsPaused and set it to true when the page is in the background.

Using
B4X:
Sub B4XPage_Disappear
 IsPaused = True
End Sub

Sub B4XPage_Appear
 IsPaused = False
End Sub

Then use :
B4X:
If MyaPage.IsPaused = True Then
End If
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
B4XPages are never paused. You can create a boolean variable IsPaused and set it to true when the page is in the background.

Using
B4X:
Sub B4XPage_Disappear
IsPaused = True
End Sub

Sub B4XPage_Appear
IsPaused = False
End Sub

Then use :
B4X:
If MyaPage.IsPaused = True Then
End If
Thanks @jahswant . It's something like this I was thinking to do but I thought that could exist something "built in" in B4XPages library that storages the page status. One thing more: if an app in B4XPages is fully in background. Is there any way to detect or it's required to test all pages for False?
 
Upvote 0

jahswant

Well-Known Member
Licensed User
Longtime User
  • B4XPage_Background - Called when the app is moved to the background. This event will be raised in all pages that implement this sub, not just the top event. This is a good place to save anything that needs to be save as the process might be killed later. Note that in B4J it is raised when the last page is closed.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You can check whether the app is in the foreground with B4XPages.GetManager.IsForeground.
2. You can check which pages are in the stack with B4XPages.GetManager.mStackOfPageIds (it is a B4XSet that holds the pages ids).
3. You can check whether B4XPages was initialized with B4XPages.IsInitialized. This is relevant if there are cases where the app starts in the background, for example with push notifications.
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
1. You can check whether the app is in the foreground with B4XPages.GetManager.IsForeground.
2. You can check which pages are in the stack with B4XPages.GetManager.mStackOfPageIds (it is a B4XSet that holds the pages ids).
3. You can check whether B4XPages was initialized with B4XPages.IsInitialized. This is relevant if there are cases where the app starts in the background, for example with push notifications.
Thanks @Erel ! I'll use those commands to manage app status and pages.
 
Upvote 0
Top