Reputation: 7023
I am having a strange issue related to APK that is when I install the apk after exporting it with signature and when I install it first time on device it it works fine but if I press home key app goes to background and when I bring it to foreground again it starts from the beginning not from the current screen but if i press back button end application and starts again then its behavior is perfect as I defined means if I m on a specific screen and press home button and send App to back ground and then bring it to fore ground it show the specific activity from where I send it to back ground.
Does any one have this strange behavior ?
In each activity I have added onResume Method. any help will be grateful.
Upvotes: 2
Views: 417
Reputation: 95578
This is a long-standing bug in Android :-( This happens when you install the application using the installer, or from an IDE (like Eclipse or IntelliJ) or after download via web browser. When the application is launched like this, when the user returns to the HOME screen and launches the app again, Android doesn't do what it is supposed to do (ie: bring the existing task to the foreground and let the user continue). Instead, Android launches the root activity again into the existing task. This causes a ton of problems for most applications.
There isn't anything you can do to correct the behaviour. There are some ways to detect this and then you can react accordingly. See the following:
How to prevent multiple instances of an activity when it is launched with different intents
Upvotes: 4