简体   繁体   中英

Android stack clear without calling another activity

How do I clear the stack without starting another activity? I tried

testIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
           startActivity(testIntent):

But it requires me to start another activity. Is there any other way? Please help.

Have you seen this post: Removing an activity from the history stack

That may or may not be helpful.

You can add a android:noHistory="true" to your <Activity /> in AndroidManifext.xml or you can use the FLAG_ACTIVITY_NO_HISTORY when calling your activity.

Without knowing exactly why you need this functionality, I can't offer any suggestions on how to implement. Maybe you can find a way to reorganize your app so that you can take advantage of this.

您可以手动跟踪应用程序中正在运行的每个活动,并在每个活动上调用finish()。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM