Tuesday, 15 May 2012

android - Reconsiling the lifecycle methods and back key -


An Android appears to be incompatible with docs, therefore responding to a question here on SO

According to Android Docs "When the user presses the back button, the current activity goes above the stack (the activity is lost) and the previous activity starts again (its The previous state of the UI is restored). "

However, at the same time Ujav gives that activities have been automatically deleted, but UI is partially hidden, if the UI is completely hidden, and deleted only if low on system resources.

These are two opposite positions, so I have a question - what is this?

For a while, screaming to Raghunathan for going ahead with me in the comments. Hopefully we will get an answer.

There is no contradiction between these two methods.

onDestroy is called as long as you do not override the finish () to call onBackpressed Or do weird thing on overriding finish and not calling super.finish () .

If you do not stop the call at Activity.finish , onDestroy is called always .

The other statement does not speak anything about being pressed back and I can not find here under the link given by you

and destroy Only if resources are low on resources.

Additinally to onDestroy is said to be when the app is low on resources (which is oddly like 'This is not happening on my phone, It is called) when global activity (from all applications) starts after 20 other activities.

I also forwarded you to check again onDestroy is not being called for a real cause.

No comments:

Post a Comment