搬运自Android Developer
Activity
Managing the Activity Lifecycle
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:
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.
关于onStop和onPause导致状态的区别
Difference between onPause and onStop
简单的说,activity被pause后,可能只是一部分被挡住,还有别的地方是可见,或者上面的activity是透明的,但是不能和用户交互;但是stop后是完全不可见的。
Fragment
Building a Dynamic UI with Fragments