Close two activities

0

I have two activities that are called in the following sequence: The first is inserted a text and once clicked on a button, it leads to a second activity. This second activity, when clicking on a next button, is then taken to a third activity, the first two, must be completed and the third continue on the screen.

Note: I can not end the first by calling the second one.

Is this possible?

Thank you.

    
asked by anonymous 14.09.2016 / 22:27

1 answer

5

Do this when you move on to the next Activity:

Intent intent = new Intent(Activity2.this, Activity3.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);

Placing this Flag, you clear the stack of Acitivitys that you are accumulating.

    
14.09.2016 / 22:29