2

I want to implement the following logic. I have 4 activites A, B, C and D.

The flow is A -> B -> C -> D

When the user navigates from A -> C he should be able to get back to the previous activities by pressing the back button. But after reaching D pressing the back button should take him to activity A. And pressing the back button againg should exit the application instead of taking him back to B / C / D. How do I do it.

Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155

1 Answers1

0

I don't know if you actually can manipulate the stack of application like your suggesting in your title.

My app runs in opengl so I never actually change form one Activity to another but I think the following principle will also work:

Why don't you call the Activity you want yourself ?

it is really straight forwards in the back button event to handle this.

on back pressed -> load activity you want

if your in activity A then exit

Jason Rogers
  • 19,194
  • 27
  • 79
  • 112