Search code examples
androidandroid-activitybackgroundondestroy

onDestroy being called


I can't figure out the onDestroy() behaviour. My question is: Is there any chance that an activity will be killed without calling it's onDestroy() while not killing the hole app? I mean, Could it be that I'll get back to my app (to an activity other then the activity that the launcher calls) and be in a situation where one activity was killed without calling it's onDestroy()?

I have a need to know that if I get back from the background to an activity that there is no way some of my activities where killed without it's onDestroy.

Thanks!


Solution

  • No i don't think so , when your application get killed because of lack of Memory your whole app process would be killed so in this situation onDestroy() may not be called and your app will back again on your launcher Activity unless you can save your application state on onPause() state before your app get killed.