我需要運行一個活動,但清除所有的堆棧,即使是我運行一個新堆棧的活動。如何從Acrtivities中清除背堆棧(當前任務)
這裏是一個例子。
A->B
活動A開始活動B
開始活動B.
Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
Intent.FLAG_ACTIVITY_NO_HISTORY
時但是,當活動B開始我仍然可以看到活動我曾嘗試使用以下標誌A在任務中。 使用以下命令
adb shell dumpsys activity | grep -i run
,得到了以下結果
Running activities (most recent first):
Run #0: ActivityRecord{5296b78c u0 com.android.launcher/com.android.launcher2.Launcher t1}
Running activities (most recent first):
Run #2: ActivityRecord{528a3310 u0 com.test.app/com.test.app.B t19}
Run #1: ActivityRecord{52bb7a34 u0 com.test.app/com.test.app.A t19}
Run #0: ActivityRecord{52c7ed5c u0 com.android.documentsui/.DocumentsActivity t11}
ACTIVITY MANAGER RUNNING PROCESSES (dumpsys activity processes)
User #0: mState=RUNNING
正如你可以看到一個活動還在這裏。是否有可能清除後端堆棧?
你完成你的酶活性的同時,對活動B移動? –