Android Question Finish multi-activities

iglrs1

Member
Licensed User
Longtime User
Hi,


I have a list of activities that open sequentially. For example, Activity 1 call Activity 2, then Activity 2 open Activity 3, Activity 3 open Activity 4 and finally Activity 4 open Activity 5. All the activities have Appcompact navigation toolbar with the arrow (back).


When Activity 5 is finished, Activity 2 is called. I would like in Activity 5 before calling Activity 2, closing(finish) Activity 3 and 4, so when you are in Activity 2 and you press the Back button or the arrow of the navigation toolbar, you go to Activity 1 and not to another.


Somebody could help me?


Thank you,

 

klaus

Expert
Licensed User
Longtime User
In Activity3 and in Activity4 add
Activity.Finish
before you call the next Activity with
StartActivity(ActivityX)
Whithout Acrivity.Finish the OS goes back to the previous Activity when you press the back button.
With Acrivity.Finish the OS skips this Activity.
 
Upvote 0

iglrs1

Member
Licensed User
Longtime User
Thanks,

The problem is that if I am in Activity 4, I want to to go to Activity 3 when I press the back button. Only when go to Activity 2 from Activity 5 is when I need to finish Activity 3, 4 and 5.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…