0

I have those activities on the stack A->B->C->D and I want to come back to activity B from activity D removing the activities between B and D (A->B).

I have tried this:

Intent intent = new Intent(this, B);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);

But doing that I also delete the A activity from the stack.

Do you know How could I handle that?

Thank you

MarcForn
  • 3,321
  • 7
  • 25
  • 39
  • 1
    Try This this might help http://stackoverflow.com/questions/12947916/android-remove-all-the-previous-activities-from-the-back-stack – user2239842 Jun 19 '15 at 04:56

1 Answers1

0

You can use

Intent intent = new Intent(this, B);
startActivity(intent);
finish()

on the activities that you want to remove from the stack

Ratzo
  • 958
  • 1
  • 7
  • 13