Activity启动模式
2016-07-12 23:05
225 查看
Activity 一共有四种启动模式。
用例 | 启动模式 | 多个实例? | 描述 |
---|---|---|---|
Normal launches for most activities | “standard” | Yes | Default. The system always creates a new instance of the activity in the target task and routes the intent to it. |
“singleTop” | Conditionally | If an instance of the activity already exists at the top of the target task, the system routes the intent to that instance through a call to its onNewIntent() method, rather than creating a new instance of the activity. | |
Specialized launches(not recommended for general use) | “singleTask” | No | The system creates the activity at the root of a new task and routes the intent to it. However, if an instance of the activity already exists, the system routes the intent to existing instance through a call to its onNewIntent() method, rather than creating a new one. |
“singleInstance” | No | Same as “singleTask”, except that the system doesn’t launch any other activities into the task holding the instance. The activity is always the single and only member of its task. |
singleTask与singleInstance的区别:
The “singleTask” and “singleInstance” modes also differ from each other in only one respect: A “singleTask” activity allows other activities to be part of its task. It’s always at the root of its task, but other activities (necessarily “standard” and “singleTop” activities) can be launched into that task. A “singleInstance” activity, on the other hand, permits no other activities to be part of its task. It’s the only activity in the task. If it starts another activity, that activity is assigned to a different task — as if FLAG_ACTIVITY_NEW_TASK was in the intent.相关文章推荐
- Android LayoutInflater原理分析,带你一步步深入了解View(一)
- Java面向对象三大特征——多态
- hdu 5212(莫比乌斯反演)
- jdbc加载驱动 Class.forName()的作用
- hdu 2181 哈密顿绕行世界问题(dfs)
- (15.1.17)鹅厂专家详解Android N适配要点
- 231. Power of Two
- Linux下hello.ko内核模块制作的全过程
- Spring+Struts2
- spring security起步三:自定义 4000 登录配置与form-login属性详解
- C语言数据类型(二)——数据类型重要知识点
- HTML5基础与Meta http-equiv属性详解
- 对dubbo进行重构,支持thrift原生协议直接调用
- Think4Android(二)之Button
- Struts2
- 会话状态
- dubbo三种协议性能对比
- iOS流媒体开发之二:滑动手势控制音量、亮度和进度
- Core 发布至Linux
- win7 绿色版MySQL安装与配置