I use intent to go to other Activity
This is my way: Activity A -> B -> C -> D -> E.
When i press Back, it go E -> D -> C-> B-> A
but, in Activity E, when press Back, i want to come back to C, so i use
mIntent.setClass(E.this, C.class);
startActivity(mIntent);
My problems is: When i come to C from E, i press back, it come back to E. But i want to come back to B like C-> B-> A.
In my opinion, when i use above code, i create new Activity C, so i cant come back to Activity B
How can i solve it?
Thanks you so much
Call
finish()on D when you move to E, this will remove them from the stack and cause E to go to C. Your stack will look like E, C, B, A because D is removed.