I have an application with two activities.
A and B
显示不同活动的清单xml。
<activity
android:name=".A"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".B"
android:label="@string/title_activity_money_manager_home"
android:screenOrientation="portrait">
</activity>
活动的启动方法如下:
活动A - &gt;活动B [从B发起]
Intent i = new Intent(this,B.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
After that ,
I want
i) **A** need not be seen in Recents
ii) From **B** , If i press back key , **A** need not be shown . i.e A should be shown only once like a splash screen of an application
iii)The Activity **B** need to be in **new stack** and it need to be root of application
Please help me out ..
答案 0 :(得分:0)
在startActivity之后调用完成
Intent i = new Intent(this,B.class);
startActivity(i);
finish();