I struggled with this odd behavior for over a month, but I finally figured out the explanation as a result of trial and error.
This behavior occurs when you launch the application from Eclipse, from the command line, or if you install the application and click the Open button (instead of the Done button) to launch the application immediately after installing it.
If in one of these cases you run your application, go to Activity1, and then to Activity 2, click the HOME button and then click the application icon and it will open a new instance of Activity1. Do not take my word for it. Just hit BACK and make sure it takes you to Activity2, which you left when you clicked HOME.
It seems that the launch activity does not fit into the activity stack if the application is launched in one of the above ways, so it creates a new instance of the launch activity on top of the current actions in the application stack. It looks like an error.
So, a workaround would be to exit the application, the first time you start from Eclipse or the command line or Open button, etc., by pressing the BACK button as many times as necessary, and then enter the application again. From now on, the behavior will be as expected.
Catalin morosan
source share