When activity is restored after was being killed by the system (I mean app process was killed, and process restarts with old activities stack), activity restore old it's state - is it possible to clear this activity state and restart activity from from scratch.
Asked
Active
Viewed 1,407 times
3
-
You could just opt out of actually reading the saved state. – Greg Giacovelli Oct 10 '12 at 07:16
-
how? please add more details. – pvllnspk Oct 10 '12 at 07:21
-
android:alwaysRetainTaskState="false" ? – pvllnspk Oct 10 '12 at 07:26
-
um just don't do anything. Like if it got killed, the onCreate() will be called again. Just don't read any state, just go and redo it all – Greg Giacovelli Oct 10 '12 at 07:29
-
I don't read any state, but after killing the activity starts not from scratch(it remember it's old layout). :( – pvllnspk Oct 10 '12 at 07:31
1 Answers
0
Just check which method is called when your activity is killed...onDestroy() or onPause(), as most probably. When "killed" your activity is not actually destroyed, it is paused, hence onResume() is executed, as your state is preserved. To destroy the activity you can use finish() in your onPause() method, have a look at this post on how to do it.

Community
- 1
- 1

faizanjehangir
- 2,771
- 6
- 45
- 83