---------------------------------------------------------------------------
Hello All,
This is very easy solution for this question.
A->B->C->D
We start from A and now we are on D activity.
We used intent for jump one activity to another.
Note: yet we not use finish...
Means A,B,C is running in background...
So, therefore we need to finish all (A,B,C) activities from activity C.
--------------------------
Step 1 : Save A, B, C activity in static Activity Vector. Create Static class and create Activity Vector.
public class VARIABLES_STACK_RANJIT {
public static Vector<Activity> v_context = new Vector<Activity>();
}
Step 2 : Write following code in A,B,C activity
i) VARIABLES_STACK_RANJIT.v_context.add(A.this);
ii) VARIABLES_STACK_RANJIT.v_context.add(B.this);
i) VARIABLES_STACK_RANJIT.v_context.add(C.this);
Step 3 : Write final code in D activity
Start loop and finish manually all saved activity.
for (int i = 0; i < VARIABLES_STACK.v_context.size(); i++) {
(VARIABLES_STACK.v_context.elementAt(i)).finish();
Log.e("Activity :" + i, "finished...");
}
---------------------------------------------------------------------------
Hello All,
This is very easy solution for this question.
A->B->C->D
We start from A and now we are on D activity.
We used intent for jump one activity to another.
Note: yet we not use finish...
Means A,B,C is running in background...
So, therefore we need to finish all (A,B,C) activities from activity C.
--------------------------
Step 1 : Save A, B, C activity in static Activity Vector. Create Static class and create Activity Vector.
public class VARIABLES_STACK_RANJIT {
public static Vector<Activity> v_context = new Vector<Activity>();
}
Step 2 : Write following code in A,B,C activity
i) VARIABLES_STACK_RANJIT.v_context.add(A.this);
ii) VARIABLES_STACK_RANJIT.v_context.add(B.this);
i) VARIABLES_STACK_RANJIT.v_context.add(C.this);
Step 3 : Write final code in D activity
Start loop and finish manually all saved activity.
for (int i = 0; i < VARIABLES_STACK.v_context.size(); i++) {
(VARIABLES_STACK.v_context.elementAt(i)).finish();
Log.e("Activity :" + i, "finished...");
}
---------------------------------------------------------------------------
Good One Ranjit...Helps a lot....
ReplyDeleteThank you!
DeleteI thought it will work.....
ReplyDeleteThanks for posting....
Yes, Rajesh,
DeleteThis code is working fine.
I used in my recent code...