01_translation_avtivity生命周期01

Managing the Activity Lifecycle  生命周期的管理

As a user navigates through, out of, and back to your app, the Activity instances in your app transition between different states in their lifecycle. For instance, when your activity starts for the first time, it comes to the foreground of the system and receives user focus. 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. 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第一次启动时,就得到了系统的前景和接收用户的焦点。在这个过程中,Android系统调用一系列的生命周期方法的activity设置用户界面和其他组件。如果用户执行一个动作,开始另一个activity或切换到另一个应用程序,系统在你的activity中调用另一组生命周期方法,因为它进入了后台(活动不再是可见的,但实例及其状态保持不变)。

Within the lifecycle callback methods, you can declare how your activity behaves when the user leaves and re-enters the 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.

在生命周期回调方法中,当用户离开和重新进入activity时可以声明activity行为。例如,如果您正在构建一个流媒体视频播放器,你可能会将用户切换到另一个应用程序暂停视频和终止网络连接。当用户返回时,你可以重新连接到网络,允许用户从同一地点恢复视频。

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.

这个类解释了的生命周期回调方法的重要性,也就是每个activity实例接收和如何使用它们来使你的activity完成用户的期望,并且当你的活动不需要他们时不消耗系统资源。

Lessons  课程

Starting an Activity启动一个Activity
Learn the basics about the activity lifecycle, how the user can launch your app, and how to perform basic activity creation.
了解了活动的生命周期的基础,用户就可以启动应用程序,以及如何执行基本的创造活动。
Pausing and Resuming an Activity暂停和恢复一个Activity
Learn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.
当activity暂停(部分被遮挡)和恢复时,你要了解发生了什么,以及在这些状态改变期间你应该做的是什么
Stopping and Restarting an Activity停止和重新启动一个Activity
Learn what happens when the user completely leaves your activity and returns to it.
了解当用户完全离开activity并返回时发生了什么。
Recreating an Activity重新创建一个Activity
Learn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.
了解当activity被销毁时会发生什么,以及必要时如何重建activity状态。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值