Android stack clear without calling another activity
How do I clear the stack without starting another activit开发者_如何学Goy? 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.
You can manually keep track of every activity that is running in your application and call finish() on each one of them.
精彩评论