Android Question To find out whether my app is active or paused

toby

Well-Known Member
Licensed User
Longtime User
I plan to add a Starter boolean variable to keep track of the state of my apps:
1. Default projects: Set it to True in Activity_Pause and to False in Activity_Resume in every activity
2. B4XPage projects: Set it to True in B4XPage_Background and to False in B4XPage_Foreground in every page.

I don't think there is any reason this approach wouldn't work, and I'm just wondering whether there is any easier way, doing it at single location with a few lines of code.

TIA
 

LucaMs

Expert
Licensed User
Longtime User
If you never remove the B4XMainPage (which doesn't mean it must always be visible), you can put that variable in the Class_Globals of this page, set it as you wrote, in events B4XPage_Background and B4XPage_Foreground in this B4XMainPage only and check it from anywhere.
 
Upvote 2
Top