android intent.FLAG_ACTIVITY_NEW_TASK 不新建tast

心鑫發表於2013-08-21
Intent intent=new Intent(Main.this, B.class);
			intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
			Main.this.startActivity(intent);



 <activity
            android:name=".A"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name=".B"
            android:taskAffinity="aaa.aaa" 
            android:allowTaskReparenting="true" 
            android:label="@string/app_name" >
        </activity>

System.out.println("maina"+this.getTaskId());

A並不會新建任務tast. B會新建任務tast 

借籤自:http://www.zhihu.com/question/20113407

相關文章