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().Android Liftcycle_第1张图片

Android Liftcycle_第2张图片

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.

Android Liftcycle_第3张图片

Android Liftcycle_第4张图片


更多相关文章

  1. Android 自定义控件之图片裁剪
  2. android访问网络图片
  3. android checkbox 定制(修改checkbox 的图片)
  4. 【Android】简单图片浏览器
  5. android图像处理系列之三--图片色调饱和度、色相、亮度处理
  6. Android使用xml自定义图片
  7. Android 图片缩放与旋转
  8. android 获取图片
  9. android 读取,写入图片到sd卡源码

随机推荐

  1. Android对Linux内核的增强:Low Memory Kil
  2. Android(安卓)应用程序
  3. Android的memory maps
  4. Android 开发视频推荐
  5. Android软件开发之盘点所有Dialog对话框
  6. android:绘图 (android.graphics包)
  7. android 跨应用程序广播发送接受
  8. android studio生成aar包并在其他工程引
  9. flutter插件开发学习之旅(7)-------双平台
  10. Android 正移植到C#