text: Q:
  
  Close multiple activities on stack
  
  Found lots of similar questions but none that suited my situation.
  Basically I have an Android app that flows like so:
  HOME >> CHECKOUT 1 >> CHECKOUT 2 >> CONFIRMATION PAGE
  
  Once we get to the confirmation page I want to 'finish' both checkout pages as I don't want the user seeing orders that have been submitted if they were to hit the back button. I know how to finish the Checkout 2 page once I confirm the order but I don't know how to 'cascade' down the stack to finish both.
  When the user hits Back on the confirmation page they should go to the Home screen. I know how to do this with Intents but that's no good for the back button. Unless I override the back button behaviour and do something like:
  Intent intent = new Intent(getApplicationContext(), Home.class);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  startActivity(intent);
  
  But I feel like this is very hacky. Anyone know the proper way to do it? Some sort of session variable that Checkout1.onResume looks for maybe?
  Cheers
  
  A:
  
  I ended up just overriding the onBackPressed method and using doing this
  Intent intent = new Intent(getApplicationContext(), Home.class);
  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  startActivity(intent);
  
  I'll wait a while before marking the answer in case someone has a better way.
  
  