Managing the Activity Lifecycle
2013-06-28 09:45
411 查看
原链接:http://developer.android.com/training/basics/activity-lifecycle/index.html
As a user navigates through, out of, and back to your app, the
As a user navigates through, out of, and back to your app, the
Activityinstances 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).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.This class explains important lifecycle callback methods that each
Activityinstance 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.
Lessons
Starting an ActivityLearn the basics about the activity lifecycle, how the user can launch your app, and how to perform basic activity creation.Pausing and Resuming an ActivityLearn what happens when your activity is paused (partially obscured) and resumed and what you should do during these state changes.Stopping and Restarting an ActivityLearn what happens when the user completely leaves your activity and returns to it.Recreating an ActivityLearn what happens when your activity is destroyed and how you can rebuild the activity state when necessary.相关文章推荐
- android-Managing the Activity Lifecycle
- Managing the Activity Lifecycle笔记
- Android官方Training阅读笔记 ---- Managing the Activity Lifecycle(Pausing and Resuming an Activity) (二)
- Managing the Activity Lifecycle--管理Activity生命周期
- 2-1 Managing the Activity Lifecycle
- Managing the Activity Lifecycle
- Managing the Activity Lifecycle
- Training—Managing the Activity Lifecycle
- Managing the Activity Lifecycle
- Develop--Training(四)Getting Started--Managing the Activity Lifecycle
- Android官方Training阅读笔记 ---- Managing the Activity Lifecycle(Stopping and Restarting an Activity) (三)
- Android官方文档翻译 十六 4.Managing the Activity Lifecycle
- Activity生命周期管理(Managing the Activity Lifecycle)
- Managing the Activity Lifecycle 管理活动的生命周期
- (2)Managing the Activity Lifecycle
- Android Develop Training——管理Activity的生命周期(Managing the Activity Lifecycle)
- Android官方Training阅读笔记 ---- Managing the Activity Lifecycle(Starting an Activity) (一)
- Managing the Activity Lifecycle
- Android官方Training阅读笔记 ---- Managing the Activity Lifecycle(Recreating an Activity) (四)
- lesson 3 Managing the Activity Lifecycle