我正在寻找一种从历史堆栈中删除某项活动的方法,发现一个解决方案这里(Wakkas的anwer)。但是,如果我关闭该活动,则打开此活动。按HOME按钮,后来返回它,活动未恢复。

如果我删除“nohistory”属性,它会回来并在杀死后恢复。

有没有办法使其在历史堆栈上没有出现(=不希望通过按下此行为按下下一个活动中的后按钮来返回它)?

亲切, 水母

有帮助吗?

解决方案

I don't think so - leaving the activity via the "Home" button and opening a new activity will have the same effect: if your activity is not in the history stack, it should not be restored.

Instead of using the "noHistory" attribute, couldn't you just call finish() as you launch your next activity? It should not re-appear when you then hit the "back" button.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top