Activity 生命周期

Managing the Activity Lifecycle
Activity生命周期的管理
        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,因为它进入后台(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行为当用户叶子和re-enters 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用户的期望,不消耗系统资源当你的Activity不需要他们。


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.
    基本了解Activity的生命周期,用户可以启动应用程序,以及如何执行基本的创造Activity。


Pausing and Resuming an Activity
暂停和恢复活动
    Learn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.
    基本了解Activity的生命周期,用户可以启动应用程序,以及如何执行基本的创造Activity。


Stopping and Restarting an Activity
停止和重新启动一个活动
    Learn what happens when the user completely leaves your activity and returns to it.
了解当用户完全离开你的Activity并返回它。


Recreating an Activity
重新创建一个Starting an Activity
    Learn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.
了解会发生什么当你的活动是摧毁,必要时如何重建Activity状态。


   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值