During the life of an activity, the system calls a core set of lifecycle methods in a sequence similar to a step pyramid. That is, each stage of the activity lifecycle is a separate step on the pyramid. As the system creates a new activity instance, each callback method moves the activity state one step toward the top. The top of the pyramid is the point at which the activity is running in the foreground and the user can interact with it.

As the user begins to leave the activity, the system calls other methods that move the activity state back down the pyramid in order to dismantle the activity. In some cases, the activity will move only part way down the pyramid and wait (such as when the user switches to another app), from which point the activity can move back to the top (if the user returns to the activity) and resume where the user left off.

As you'll learn in the following lessons, there are several situations in which an activity transitions between different states that are illustrated in figure 1. However, only three of these states can be static. That is, the activity can exist in one of only three states for an extended period of time:

Resumed

In this state, the activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.)

Paused

In this state, the activity is partially obscured by another activity—the other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. The paused activity does not receive user input and cannot execute any code.

Stopped

In this state, the activity is completely hidden and not visible to the user; it is considered to be in the background. While stopped, the activity instance and all its state information such as member variables is retained, but it cannot execute any code.

The other states (Created and Started) are transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls onCreate(), it quickly calls onStart(), which is quickly followed by onResume().


That's it for the basic activity lifecycle. Now you'll start learning about some of the specific lifecycle behaviors.


//上面大概意思说activity存活的时候,会调用一大堆方法,就像图片显示那样,形成一个金三角

resumed 显示当前给用户看

Paused 透明状态

Stopped 在后台运行中

我是从最新的文档摘下来的,

更多相关文章

  1. 如何在后台运行Linux命令?
  2. 写出一份“有理有据使人信服”的Android项目设计文档,这个技能也
  3. Android高手进阶教程(十八)之---列出Android设备中所有启动的服
  4. Android(安卓)stdio笔记
  5. 最近用android写的一个项目,开发心得
  6. Android开发AsyncTask异步处理任务使用方法及注意事项
  7. Android用itext生成含中文的PDF文档
  8. Android官方开发文档Training系列课程中文版:高效显示位图之管理
  9. android 系统权限大全的简介与内容

随机推荐

  1. 《Authing 十问》拆解身份云:如何有效降低
  2. 游戏AI领域,机器人技术的研究与应用
  3. 2020 年上半年互联网公司"死亡"名单!
  4. 老牌大型门户网站多年经验——搜狐服务架
  5. 经历了研发困局、运维之痛,同程微服务从1
  6. 卧槽!PanDownload复活了!60MB/s
  7. 大数据时代,传统数据仓库技术是否已经过时
  8. 后台九 文章列表
  9. 4.0 Ansible Playbook复用
  10. 你只知大数据的便利,却不知漏洞——hadoop