Android Question Return to MainAcitivity

Arturs

Member
Licensed User
Longtime User
Hi

I have aplication with three activities.
After Pausing my aplication should start working from MainActivity (always) independent on which activity worked before Pausing

How to do it ?

Regards
Artur
 

Arturs

Member
Licensed User
Longtime User
Sorry, I misunderstood you. Of course I use StarterService but I did not know that it is the same as Service Module.
I use it in foreground mode so it is running all the time.
I can call from current activity in the place

B4X:
Sub Activity_Pause (UserClosed As Boolean)

End Sub

a SUB from Service Module and do something but how to detect that currently activity was unpaused and switch my aplication to Main Activity
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
Does the user need to be able to navigate back and forth between the other 2 activities? If not perhaps you can just call Activity.Finish in both of those Activity_Pause routines?
 
Upvote 0

cimperia

Active Member
Licensed User
Longtime User
Why not use a Process Global variable, and check its value?

B4X:
'Main activity
Sub Process_Globals
  Dim HasAnyActivityPaused As Boolean = False
End Sub

You would set it to True in all other activities whenever they pause.

B4X:
Sub Activity_Pause (UserClosed As Boolean)
  HasAnyActivityPaused = True
End Sub

Now you check that flag in the Activity_Create or Activity_Resume sub (whatever is best for your app). And if it's set to True, you finish the current activity and return to Main, where you reset the boolean flag to False.
 
Upvote 0
Top