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