拆下返回堆栈的所有活动,同时呼吁一个新的活动 [英] Remove all activities from Back Stack while calling a New activity

查看:119
本文介绍了拆下返回堆栈的所有活动,同时呼吁一个新的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  安卓:清除背叠

有什么办法来清除,当我打电话了新的活动在back_Stack这不是present?(我用的阿比vesion 8)back_Stack ..请帮助?

Is there any way to clear the back_Stack when I am calling a new Activity which not present in the back_Stack?(I am using Api vesion 8).. pls Help?

推荐答案

不知道你的precise要求,这是很难给你一个确切的答案,但是你可以使用的任务的实现你需要什么。如果你有一个名为A 3的活动,B和; C.如果设置C到有不同的 taskAffinity 来急症室;乙方在清单,然后单独回堆栈用于C.如果再设置 clearTaskOnLaunch =真正的有关的清单,然后后退堆栈将清除时用户离开该任务。因此,应用程序启动负载活性答:用户点击一个按钮,启动B.如果用户点击,现在回来了,他们返回A.如果从B用户点击一个按钮,启动C,则A的任务后面堆&安培; B被清零,并且如果用户然后打回它们将返回到<一href=\"http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html#Affinities\">A.

Without knowing your precise requirements, it is difficult to give you an exact answer, but you can use tasks to achieve what you need. If you have 3 activities named A, B & C. If you set C to have a different taskAffinity to A & B in the Manifest, then a separate back stack is used for C. If you then set clearTaskOnLaunch="true" for A in the manifest, then the back stack will clear when the user leaves that task. So, app launch loads activity A. The user clicks a button which launches B. If the user now clicks back, they return to A. If from B the user clicks a button to launch C, then the back stack of the task for A & B is cleared, and if the user then hits back they are taken back to A.

这方面的一个全面的解释可以在<一个找到href=\"http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html#Affinities\">Handling相契和<一个href=\"http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html#Clearing\">Clearing后退堆栈。

A full explanation of this can be found at Handling Affinities and Clearing the back stack.

这篇关于拆下返回堆栈的所有活动,同时呼吁一个新的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆