什么是“活动记录对象"?在Android中? [英] What is "activity record object" in Android?

查看:111
本文介绍了什么是“活动记录对象"?在Android中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是下一篇文章,以进一步了解活动的生命周期,并找到短语活动记录对象"

I was referring to following article to further understand the life cycle of the activity and found phrase "activity record object"

引用文章:

藏匿活动时,不存在活动对象,但是 活动记录对象位于操作系统中.操作系统可以重新设置活动记录对象的动画 活动记录在需要时使用该活动.

When your activity is stashed, an Activity object does not exist, but the activity record object lives on in the OS.The OS can reanimate the activity using the activity record when it needs to.

调用onSaveInstanceState(...)时,数据将保存到 捆绑对象.然后将该捆绑对象塞入您活动的 操作系统的活动记录

When onSaveInstanceState(...) is called, the data is saved to the Bundle object.That Bundle object is then stuffed into your activity's activity record by the OS

任何人都可以准确定义活动记录对象" 的含义吗,并且OS是否仅通过终止活动即可节省大量内存?

Could any one define exactly what is meant by "activity record object", and does OS save considerable amount of memory by just killing an activity ?

推荐答案

我在这里写了您引用的文章(摘自 Brian Hardy ,我写了 Android编程:大书呆子牧场指南).让我看看能否回答您的问题.

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 OS中,用于跟踪您的活动.该对象是您保存的实例状态的存储位置;这是最初开始您的活动的意图所在的地方,您收到的活动结果在交付之前就存储在这里.更重要的是,如果活动记录仍然存在,则可以将其用于重新构建应用程序中的活动"实例.

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类的实例相比,保持活动记录对象的生存成本要低得多.一个Activity实例具有一个完整的视图层次结构,它本身很容易占用几兆字节的内存.最重要的是,Activity实例要求您的应用程序进程存在.因此,如果没有Activity实例,Android也可以摆脱整个过程.

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.

这篇关于什么是“活动记录对象"?在Android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆