-1

I have couple of activities , let say A, B, C, D, E , Where A is the starting activity . On all the activities I have a navigation drawer with tabs to start these activities. The type of behavior I m planning is that no matter where the user is he will be able to swipe the navigation drawer and switch to any activity of choice. In this case every time a new activity is started (Other than activity A) all the activity from stack should be removed and the stack should only have (Activity A and the new started activity)

How can I remove all activity from the stack and put the chosen activity on top of Activity A.

Vihaan Verma
  • 12,815
  • 19
  • 97
  • 126

1 Answers1

0

You don't need to clear the stack, just set FLAG_ACTIVITY_REORDER_TO_FRONT to the intent you are starting: intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT). Here is the link for the official documentation.

Ayoub
  • 341
  • 1
  • 13