As a user navigates through, out of, and back to your app, the Activity instances in your app transition between different states in their life cycle.
作为一个用户通过导航进出和回到你的应用程序的这个过程中,你应用程序的Activity实例在它的生命周期的不同状态之间转换。
For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus.
例如:当你的Activity第一次启动时,它会出现在系统的最前端并接受用户的焦点。
During this process, the Android system calls a series of lifecycle methods on the activity in which you set up the user interface and other components.
在这个过程中,Android系统调用了Activity一系列的生命周期方法,在这些方法中你可以设置用户界面和其他组件。
If the user performs an action that starts another activity or switches to another app, the system calls another set of lifecycle methods on your activity as it moves into the background (where the activity is no longer visible, but the instance and its state remains intact).
如果用户执行一个动作去启动其他的Activity或者切换到另一个应用程序,随着当前Activity移动进后台,系统会调用另一组生命周期方法。(这里的Activity不再是可见的,但是它的实例和它的状态依然保持不变)
Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the activity.
在生命周期的回调方法中,你可以声明Activity在用户离开以及重新进入Activity时的一些行为。
For example, if you're building a streaming video player, you might pause the video and terminate the network connection when the user switches to another app.
例如,如果你正在构建一个流媒体播放器,在用户切换到另一个应用程序时,你可能会暂停视频和停止这次的网络链接。
When the user returns, you can reconnect to the network and allow the user to resume the video from the same spot.
当用户返回时,你可以重新连接网络并允许用户恢复到之前同一点的视频。
This class explains important lifecycle callback methods that each Activity instance receives and how you can use them so your activity does what the user expects and does not consume system resources when your activity doesn't need them.
这一课阐述了生命周期回调方法的重要性。(好吧接下来不会翻译了。)