Understand the Lifecycle Callbacks
2013-07-29 00:00
190 查看
Implementing your activity lifecycle methods properly ensures your app behaves well in several ways, including that it:
Does not crash if the user receives a phone call or switches to another app while using your app.
Does not consume valuable system resources when the user is not actively using it.
Does not lose the user's progress if they leave your app and return to it at a later time.
Does not crash or lose the user's progress when the screen rotates between landscape and portrait orientation.
the activity can exist in one of only three states for an extended period of time:
Resumed
In this state, the activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.)
Paused
In this state, the activity is partially obscured by another activity—the other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. The paused activity does not receive user input and cannot execute any code.
Stopped
In this state, the activity is completely hidden and not visible to the user; it is considered to be in the background. While stopped, the activity instance and all its state information such as member variables is retained, but it cannot execute any code.
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
相关文章推荐
- Android官方Training阅读笔记 ---- Managing the Activity Lifecycle(Starting an Activity) (一)
- Understanding the Android Life Cycle
- #Maven# Introduction to the Build Lifecycle
- ActivityLifecycleCallbacks
- Managing the Lifecycle of a Service
- 认识registerActivityLifecycleCallbacks
- Maven报错 解决方案。ERROR: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id
- Activity生命周期管理(Managing the Activity Lifecycle)
- The ASP.NET Page Lifecycle
- Understanding the Android Life Cycle
- Android Develop Training——管理Activity的生命周期(Managing the Activity Lifecycle)
- Life Cycle of the Flex UIComponent Base Class
- Business analysis and SOA part 4 of 6: SOA delivery lifecycle and the top-down approach [by Thomas Erl]
- <Ejb3InAction> Sample03 for Weblogic - Session beans with lifecycle callbacks and @Resource inject
- The life cycle of a typical project 一个典型的项目生命周期
- 详解ActivityLifecycleCallbacks
- Software Testing: Testing Across the Entire Software Development Life Cycle
- Android官方文档翻译 十六 4.Managing the Activity Lifecycle
- The ASP.NET Page Lifecycle – A Basic Approach
- [MST] Loading Data from the Server using lifecycle hook