[关闭]
@ZeroGeek 2015-08-26T06:24:07.000000Z 字数 485 阅读 638

Activity中的launchMode

android


参考:http://developer.android.com/guide/topics/manifest/activity-element.html#maxRecents

四种启动模式:

"standard"
"singleTop"
"singleTask"
"singleInstance"

默认的是"standard" 。

"standard"和"singleTop"模式的activity可以被实例化多次

unless the Intent object contains a FLAG_ACTIVITY_NEW_TASK instruction, in which case a different task is chosen — see the taskAffinity attribute).

"singleTask" and "singleInstance" 只能实例化一次,他们通常位于activity桟的根部。

每个程序一般有一个activity桟 (可创建多个)

singleTop的activity何时不会新建:

  1. 位于目标桟的Top。
  2. 位于桟Top,但是不在目标桟。
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注