Android的:如何返回到活动与" noHistory"的onStop后的属性?属性、QUOT、Android、onStop

2023-09-12 22:21:07 作者:难挡暧昧

我一直在寻找一种方式来删除历史堆栈一定的活动,并找到了解决的这里(Wakkas的前面回答)。但是,如果我关闭这个活动的应用程序打开如由pressing home键,后来回吧,该活动是不可恢复的。

I was looking for a way to delete a certain activity from history stack, and found a solution here (Wakkas's anwer). However, if I close the app with this activity opened e.g. by pressing the home button, and later return to it, the activity is not restored.

如果我删除了noHistory属性,它回来了,也恢复了杀后。

If I remove the "noHistory" attribute, it is coming back and also restored after a kill.

有没有一种方法,使之不会出现在历史堆栈(=不想回来给它的pressing在接下来的活动中后退键)没有这种现象?

Is there a way to make it not appear on the history stack (= don't want to come back to it by pressing the back button in next activity) without this behavior?

亲切的问候, 水母

推荐答案

我不这么认为 - 离开该活动通过主页按钮,打开一个新的活动将有同样的效果:如果你的活动是不是在历史堆栈,它不应该被恢复

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.

而不是使用noHistory属性,不能你只需要调用完成()作为启动您的下一个活动?它不应该再次出现时,你再点击后退按钮。

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.