Possible Duplicate:
Android: Clear the back stack
Is there any way to clear the back_Stack when I am calling a new Activity which not present in the back_Stack?(I am using Api vesion 8).. pls Help?
Possible Duplicate:
Android: Clear the back stack
Is there any way to clear the back_Stack when I am calling a new Activity which not present in the back_Stack?(I am using Api vesion 8).. pls Help?
Without knowing your precise requirements, it is difficult to give you an exact answer, but you can use tasks to achieve what you need. If you have 3 activities named A, B & C. If you set C to have a different taskAffinity
to A & B in the Manifest, then a separate back stack is used for C. If you then set clearTaskOnLaunch="true"
for A in the manifest, then the back stack will clear when the user leaves that task. So, app launch loads activity A. The user clicks a button which launches B. If the user now clicks back, they return to A. If from B the user clicks a button to launch C, then the back stack of the task for A & B is cleared, and if the user then hits back they are taken back to A.
A full explanation of this can be found at Handling Affinities and Clearing the back stack.