How to cache views with Android and avoid calling onCreate everytime -


I have a question that is bothering me.

With Android, I find an application that seems to call onCreate every time a new instance of an activity is created because this activity is someone else's son and it It eliminates its role for a data, while eliminating itself. Calling on / P>

onCreate seems to make ideas for re-parsing XML and re-linking the code to the listeners / again and so on. So is there a way to cache an activity every time we click on the back button in the mobile device without seeing it? It is really like being hidden (not available with the back button) and it is deleted only if it is needed.

Thank you in advance :)

View the most applicable and activity caching Handle it and you should not worry about it. I warn about Alexx's approach - it's quite naive and will only spoil the performance, as well as to make memory leaks and to exclude the wrong behavior.

If you believe that activity is being created too often, then I would recommend to ensure that you are using the activity of the lifecycle correctly with every system, Android efficiency and again : Balances the applicability, and there are always objections to make.

A common misconception that you mention involves parsing the XML. XML for ideas is not stored as a pure XML, but in a compiled form for efficiency. You do not need to worry about it, trust that the system is trying to make things as efficient as you can.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -