1. "singleTask"
The system creates a new task and instantiates the activity at the root of the new task. However, if an instance of the activity already exists in a separate task, the system routes the intent to the existing instance through a call to its onNewIntent() method, rather than creating a new instance. Only one instance of the activity can exist at a time.
Note: Although the activity starts in a new task, the BACK key still returns the user to the previous activity.
官方说activity还不存在的时候会以activity为根新建一个task.但实际测试情况是这样的:
假如activity:activity_Caller 调用设置了android:lauchMode="singleTask"的activity:activity_singleTask 。
1. 如果activity_Caller 和 activity_singleTask 在同一个application,那么不会新创建一个task.
2.如果不在同一个application,但是activity_singleTask已经在task中,那么就不会创建新的task。
总结:
只有在activity_singleTask不存在任何task中,并且activity_single所在的application中的任何activity不存在在task中,并且跟调用者acitivity_caller不再同一application的时候,才会创建一个新的以它为根的task.
posted on 2011-06-17 11:13
汪杰 阅读(226)
评论(0) 编辑 收藏 引用 所属分类:
Java