android - finish an activity which is not on the top of activity stack -


I have three activities A, B and C, at the top of the activity stack. The pieces in C are F1, F2. On clicking on a button I want to replace "F1" with "F2" and I want to end A, B. Any idea how this can be accomplished.

Use Intent.FLAG_ACTIVITY_CLEAR_TASK when you start Activity D Try it This will clear all activity in the stack, but in your case, with activity C. Intent .Stflag (int. FLAG_ACTIVITY_NEW_TASK; intent. FLAG_ACTIVITY_CLEAR_TASK);

This will clear all activity in the stack.

The flag FLAG_ACTIVITY_CLEAR_TASK will be the reason for any existing work that will be associated with the activity clearing before the activity begins. That is, the activity becomes new roots and any old activities are over. This flag can only be used in combination with FLAG_ACTIVITY_NEW_TASK

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -