我需要运行一个活动,但清除所有的堆栈,即使是我运行一个新堆栈的活动。如何从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移动? –