I have a problem with a code becuse when the display turn off the activity was destroy then it restart from onCreate....why ? when the display turn off the activity not must go to onPause??
Asked
Active
Viewed 3,599 times
2 Answers
2
Is your application in Landscape? if so, check this answer out: onDestroy gets called each time the screen goes on
Short answer: implement onConfigurationChanged() and change the AndroidManifest.xml file for this activity to: android:configChanges="keyboardHidden|orientation"
1
according to the life cycle of the Android activity, when an activity becomes background, onPause is called, however, from now on, the system can kill the activity by its will, ie. the system requires more memory.
what you met was normal.

Huang
- 4,812
- 3
- 21
- 20
-
but my activity is destroid, why ? – MimmoG Mar 04 '12 at 01:34
-
you can read the logcat to find more info. IT'S the system that decides to kill the activity or not, not the developers. IN general, IT'S because more memory are needed. – Huang Mar 04 '12 at 01:53