简体   繁体   English

清除整个android活动堆栈

[英]Clearing the entire android activity stack

Again the same question. 同样是同样的问题。 How to clear the entire stack of my activity? 如何清除我整个活动? Humble suggestion, Read the question before marking it duplicate Now Below is the diagram to give a view of my stack. 卑微的建议,在将其标记为重复之前先阅读问题,下面是提供我的堆栈视图的图。

在此处输入图片说明

Initial activity: Called from NFC tag touch and can be touched at any instance of application running. 初始活动:通过NFC标签触摸调用,并且可以在运行任何应用程序实例时触摸。 This is never maintained in stack and gets destroyed, moment new activity starts. 一旦新的活动开始,它就永远不会保持在堆栈中并被销毁。

Startup activity Called from Initial activity or icon touch. 启动活动从“初始活动”或图标触摸调用。 this is alos not maintained in stack and get destroyed moment next activity comes in foreground. 这还没有保持在堆栈中,并在下一个活动进入前台时被破坏。 But imp cause take decision which activity to start. 但是导致原因决定开始哪个活动。

main activity: This is main activity. 主要活动:这是主要活动。 start of application and gets destroyed only when app is closed. 应用程序启动,并且仅在应用程序关闭时被销毁。

Now my problem is at some instance I touch my tag, so after some condition check, I need to remove all the activities from stack before starting my StatupActivity. 现在我的问题是在某些情况下我触摸了我的标签,因此在进行一些条件检查后,我需要在启动StatupActivity之前从堆栈中删除所有活动。 Hope I have made myself clear. 希望我已经说清楚了。 Any query feel free to ask. 任何查询都可以随意询问。 Any help will be appreciated. 任何帮助将不胜感激。

okay please read this link carefully now set android:clearTaskOnLaunch="true" in AndroidManifest in StatupActivity (for your case) 好的,请仔细阅读链接,现在在StatupActivity中的AndroidManifest中设置android:clearTaskOnLaunch =“ true”(适合您的情况)

now start your activity with Intent.FLAG_ACTIVITY_CLEAR_TOP Flag 现在使用Intent.FLAG_ACTIVITY_CLEAR_TOP标志开始您的活动

it is work for me i hope you will find help... 对我来说这是工作,希望您能找到帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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