Steps to reproduce the problem.
What happened.
Appliaction is restarting from the first screen and does not retain the second screen. Application retains activites in normal way after application restart or if you pressing BACK button in application to home screen.
Application must always retain activites in normal way.
How can I solve this problem for my application? Can I restart application during first run?
Depending on how the application is defined in the manifest file and whether it has any mechanism to save and restore its state....
Based on your steps, it might create several instances of the same application (check this)
Or it is not using the instance Bunble in onCreate
It is definitely not going to be automatic for all applications to come back to the save screen it was at when it was paused or destroyed (some application do not want that, think about your bank account management...)
Edit :
So if I understand correctly from your comments, it works as you expect when you quit the application with the BACK key, but not when you use the HOME key...
Read the link I posted : http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html
You will understand that when you press the HOME key, the instance of your application you were in is not destroyed (and so the current state is not saved). Starting it again only starts another instance (from the initial screen).
When the user presses the BACK key, the current activity is destroyed and the previous activity resumes.
...
A task is a cohesive unit that can move to the "background" when users begin a new task or go to the Home screen, via the HOME key
If you want to change the way it behaves, look at the launchMode
in the manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With