As you'll learn in the following lessons, there are several situtations in which an activitytransitions between different states that are illustrated in figure 1. However, only three ofthese states can be static. That is, the activity can exist in one of only three states for anextended 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—theother activity that's in the foreground is semi-transparent or doesn't cover the entire screen. Thepaused 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 isconsidered to be in the background. While stopped, the activity instance and all its stateinformation 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 tothe next state by calling the next lifecycle callback method. That is, after the system callsonCreate(), it quickly callsonStart(), which is quickly followed by onResume().

Note: The system calls onDestroy()after it has already calledonPause() and onStop() in all situations except one: when you callfinish() from within the onCreate()method. In some cases, such as when your activity operates as a temporary decision maker tolaunch another activity, you might callfinish() from within onCreate() to destroy the activity. In this case, the systemimmediately callsonDestroy() without calling any of the otherlifecycle methods.



更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. VMware9.0安装ubuntu-12.04
  2. Android(安卓)相见恨晚的命名规约
  3. android 源码之英语单词记忆程序源码
  4. 我翻过的Android图书
  5. ARM NEON 指令
  6. Android(安卓)Annotations框架 配置及使
  7. Android用户输入系统和移植内容概要
  8. android悬浮窗及权限
  9. Android(安卓)API demos 阅读笔记 5
  10. Android常见的Event-driven方案