androidonbackpressedactivity-stack

onBackPressed() should call previous activity's onBackPressed()


So here is the problem, I perform A → B and from B I do B → C , now when the back button is pressed in C I want to go back to A. so at start the flow is A → B → C but I want to clear B when I start C so when back pressed from C I go back to A. I know I can start A from C and CLEAR_TOP but I am looking for another alternative if there is one.

Thank You


Solution

  • you can call finish(); after you start intent on B .