Suppose I have different fragments within an activity in backstack such as [1]->[2]->[3]->[4]->[5] with Fragment 5 presently visible on the screen. Now I want to go to Fragment 2 without destroying Fragments 3 and 4 on a single press of a button. How can this be done?
Asked
Active
Viewed 40 times
0
-
1Have you try this [enter link description here](https://stackoverflow.com/questions/2232238/how-to-bring-an-activity-to-foreground-top-of-stack) – Nguyễn Quang Thọ Jun 24 '20 at 04:44
-
are you using navigation component? if yes, there is method in action with singleTop, it will do the same work/ – Anshul1507 Jun 25 '20 at 01:58