Android Question closing activities

Jausa

Member
Licensed User
Longtime User
How I can close all activities that are open when my application is closed?
 

DonManfred

Expert
Licensed User
Longtime User
How I can close an activity from another activity?
If activity B is runing then the only one you can finish is activity B. That´s how android works.

What you can do is:

Asuming you have activity MAIN and B AND C.
in main when starting B
B4X:
StartActivity(B)
in B then when starting C
B4X:
Activity.finish
StartActivity(C)
When you then finish C youll get back to MAIN; not to B cause you finished it
 
Upvote 0

Jausa

Member
Licensed User
Longtime User
But if I do not finish the activity B and from C back to main, how can I close it?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
But if I do not finish the activity B and from C back to main, how can I close it?
You can NOT close activity B from C! ONLY B can. Or the system when it kills your process.
You can do in C
B4X:
activity.finish
startactivity(main)
But B stays till the task is killed or reopened again.
 
Upvote 0

Jausa

Member
Licensed User
Longtime User
If I finish an activity, global variables can then use them in another activity?

Activity A
Sub Process_Globals

Dim Client As String

End Sub

Activity B

a.client
 
Upvote 0
Top