Reputation: 2519
In my application when i install it from APK, and start it , and press home button to redirect it to background, than again open the application through its app icon, than it restarts from the begening. Means application restarting when we go out through "home button click" and come back to application How to stop this please let me know.? I dont want to restart my app when I go out thru home button click, the app must restart only after when I exit from application.
Upvotes: 1
Views: 3293
Reputation: 93
An answer can be found here: Android application restarts when opened by clicking the application icon
It can be fixed by adding this piece of code in the onCreate() method of your first Activity:
if (!isTaskRoot()) {
finish();
return;
}
The bug is explained here: https://code.google.com/p/android/issues/detail?id=26658, and the fix is given in comment #14 :)
Upvotes: 2
Reputation: 5457
First, there is no "exit from application". Then read on activity stack here to really understand how the activity is managed.
Upvotes: 0