What is an activity recording object in Android?

I had in mind the following article to further understand the life cycle of an activity and found the expression "activity recording object"

Quote:

When your activity is hidden, the Activity object does not exist, but the activity recording object lives in the OS. The OS can revive by recording activity when necessary.


When onSaveInstanceState (...) is called, data is stored in the Bundle Object. This Bundle is then added to your activity. OS activity record

Can someone accurately determine what is meant by an “activity recording object” and allows the OS to save a significant amount of memory by simply killing activity?

+6
source share
1 answer

I wrote the passage you are quoting here (this is from Brian Hardy 's book, and I wrote: Android Programming: The Big Nerd Ranch Guide ). Let me see if I can answer your questions.

An “activity recording object” (usually I say “activity recording”) is not displayed to you as an application developer. Instead, he lives in the Android OS, where he is used to track your activity. This object stores your saved instance state; where is the intention that originally began its activity when the results of the activities that you receive are stored until they are delivered. More importantly, if an activity record is active, you can use it to restore an Activity instance in your application.

An activity recording object is much cheaper than a single instance of the Activity class. An Activity instance has a whole hierarchy of views, which in itself can span several megabytes of memory. In addition, Activity instances require your application process to exist. Therefore, if there are no instances of Activity, Android can also get rid of your entire process.

+10
source

Source: https://habr.com/ru/post/951280/


All Articles