I wanted to ask about the activity's lifecycle.
If an activity is going to the background, or the user pressed the home button so the application itself is not visible anymore, the onStop()
is called, but not always destroyed.
1) when the above happens, what actually happens to the activity? Does it move to the backstack? or something else?
2) specifically related to the first question - when will the onDestroy()
method be invoked in a case where the activity has already stopped, but the onDestroy()
wasn't yet called at that moment of stopping?
3) generally about onDestory()
- I know onDestroy()
is called when the system doesn't have enough resources anymore, or when Android is destroying a portrait/landscape layout in order to load the other one. When else can it be called?