title: How to manipulate Activity back stack?
body: <p>I want to implement the following logic. I have 4 activites A, B, C and D. </p>
  
  <p>The flow is A -> B -> C -> D</p>
  
  <p>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.</p>