我有一个应用程序,它对大多数活动具有通常的任务行为,但它也有一个活动需要启动到创建它的任务上。
此活动是从 mime 类型启动的。如果另一个应用程序启动该活动,则该活动应显示在同一任务中。但是,活动总是重新分配给其应用程序的任务。尽管明确设置allowTaskReparenting
为false
.
当应用程序中没有其他活动时,活动会在启动它的任务中正确启动。只有当应用程序的其他活动存在于任务中时,它才会重新父级。
如何让活动仅在其启动的活动之上启动,与同一应用程序的其他活动分开?这是 AndroidManifest.xml 的相关部分:
<activity
android:name="com.matthewmitchell.peercoin_android_wallet.ui.RestoreWalletActivity"
android:configChanges="orientation|keyboard|keyboardHidden"
android:theme="@style/My.Theme.Dialog"
android:allowTaskReparenting="false" >
<intent-filter android:label="@string/import_keys_intent_filter_action" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-peercoin-wallet-backup" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
</activity>