Coordinating activities
来源:互联网 发布:路由器可以限制端口吗 编辑:程序博客网 时间:2024/05/16 07:42
From: http://developer.android.com/guide/components/activities.html
When one activity starts another, they both experience lifecycle transitions. The first activity pauses and stops (though, it won't stop if it's still visible in the background), while the other activity is created. In case these activities share data saved to disc or elsewhere, it's important to understand that the first activity is not completely stopped before the second one is created. Rather, the process of starting the second one overlaps with the process of stopping the first one.
The order of lifecycle callbacks is well defined, particularly when the two activities are in the same process and one is starting the other. Here's the order of operations that occur when Activity A starts Acivity B:
Activity A's onPause() method executes.
Activity B's onCreate(), onStart(), and onResume() methods execute in sequence. (Activity B now has user focus.)
Then, if Activity A is no longer visible on screen, its onStop() method executes.
This predictable sequence of lifecycle callbacks allows you to manage the transition of information from one activity to another. For example, if you must write to a database when the first activity stops so that the following activity can read it, then you should write to the database during onPause() instead of during onStop().
When one activity starts another, they both experience lifecycle transitions. The first activity pauses and stops (though, it won't stop if it's still visible in the background), while the other activity is created. In case these activities share data saved to disc or elsewhere, it's important to understand that the first activity is not completely stopped before the second one is created. Rather, the process of starting the second one overlaps with the process of stopping the first one.
The order of lifecycle callbacks is well defined, particularly when the two activities are in the same process and one is starting the other. Here's the order of operations that occur when Activity A starts Acivity B:
Activity A's onPause() method executes.
Activity B's onCreate(), onStart(), and onResume() methods execute in sequence. (Activity B now has user focus.)
Then, if Activity A is no longer visible on screen, its onStop() method executes.
This predictable sequence of lifecycle callbacks allows you to manage the transition of information from one activity to another. For example, if you must write to a database when the first activity stops so that the following activity can read it, then you should write to the database during onPause() instead of during onStop().
0 0
- Coordinating activities
- android Coordinating activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities
- Activities(活动)
- 谈Activities
- 活动 - Activities
- android-Activities
- 2.2 Activities
- Android Activities
- 枚举
- 设计模式之中介者模式
- WAVE格式解码分析
- 报道,我来了啊
- 分页和分段的联系和区别
- Coordinating activities
- 内省
- Genymotion模拟器使用问题(二 Unable to connect to your virtual device!Genymotion will now)
- Android SDK Manager中Google APIs无法显示问题(附SDK Manager文件离线安装)
- 修改mysql默认字符集的方法
- File02
- JDK源码解读之RegularEnumSet
- Android中 int 和 String 互相转换的多种方法
- js获取滚动条位置:绝对有效