且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

"活动记录物体QUOT;安卓

更新时间:2022-06-02 08:45:34

我写你在这里引用的通道(这是从书布赖恩哈迪和我写的,的Andr​​oid程序设计:大书呆子牧场指南)。让我看看,如果我能回答你的问题。

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

活动记录对象(我通常说的活动记录)是不可见的,你作为一个应用程序开发人员。相反,它生活在Android操作系统,它是用来保持跟踪你的活动。这个对象是你保存的实例状态被存储;这也正是最初开始你的活动的意图居住,那里的活动结果在交付前收到了存储。更重要的是,如果该活动记录是活的,它可被用于重建一个活动实例在应用程序

The "activity record object" (I usually say "activity record") is not visible to you as an application developer. Instead, it lives in the Android OS, where it is used to keep track of your activity. That object is where your saved instance state is stored; it's where the intent that initially started your activity lives, where the activity results you receive are stored before they are delivered. More importantly, if the activity record is alive, it may be used to reconstitute an Activity instance in your application.

活动记录的对象是便宜得多永葆比Activity类的一个实例。活动实例有一个整体视图层次,它可以很容易地占用内存数兆字节本身。最重要的是,活动实例需要您的应用程序的进程存在。因此,如果有没有留下什么活动的实例,安卓可以摆脱你的整个过程了。

The activity record object is much cheaper to keep alive than an instance of the Activity class. An Activity instance has a whole view hierarchy, which can easily take up a few megabytes of memory by itself. On top of that, Activity instances require your app's process to exist. So if there are no Activity instances left, Android can get rid of your entire process, too.