本文介绍了如何机器人:noHistory ="真"工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我有一个菜单基地的活动,当我点击菜单项,它进入活动答:我再次打开菜单,然后转到B.从BI回到A,和背部和第四这样一段时间。

Lets say I have a base activity with a menu, when I click on menu item A, it goes to activity A. I open the menu again, and go to B. From B I go back to A, and back and fourth like this for a while.

所以堆栈将A,B,A,B,A,B,....而当我打的后退按钮,它会向后如预期的协议栈。

So the stack would be A, B, A, B, A, B, ....And when I hit the back button, it goes backwards through the stack as expected.

不过可以说我不想要这个功能,所以我将添加到我的清单,安卓noHistory =真正的。所以,当我打的后退按钮退出应用程序,而不是去虽然堆栈。

However lets say I don't want this functionality, so I add to my manifest, android:noHistory="true". So when I hit the back button it exits the application instead of going though the stack.

现在的错觉使得它看起来,可以说如果我在活性的,我用的菜单进入活动B,栈也只是B,因为我不能回到A

Now the illusion makes it seem, lets say if I'm in activity A, I use the menu and go to activity B, the stack would just be B, because I can't go back to A.

但是,在使用 noHistory =真正的,没有A,B,A,B,A,B的真实堆栈存在吗?相反,是通过使用菜单实例化一个新的活动副本,每次调用一个活动,但用户无法看到它?这会不会造成资源的问题?

But, when using noHistory="true", does the true stack of A, B, A, B, A, B exist? Rather, is every call to an activity by using the menu instantiating a new copy of that activity, but the user can't see it? Would this be causing resource issues?

或者当 noHistory =假,不后退按钮只需调用像 startAcitvity(意向)再抑或是经历了被实例化每一个新的副本?

Or when noHistory="false", does the back button just call something like startAcitvity(intent) again or is it going through each new copy that was instantiated?

我很担心资源问题,而不是放慢一个用户的Andr​​oid设备。

I'm concerned with resource issues and not slowing down a users android device.

推荐答案

文档关于 noHistory

的真则表示该活动不会留下历史痕迹。它不会留在任务的活动栈,因此,用户将不能够返回到它。

关于你的问题:

确实的A,B,A,B,A,B真栈的存在?

该文档就表示没有。

我很担心资源问题,而不是放慢一个用户的Andr​​oid设备。

您真的不需要担心这个。操作系统应该处理的活动,清理时,存储空间不足。它更可能是穷人用你们的活动位图或逻辑会导致性能下降。

You really don't need to worry about this. The OS should handle the cleanup of activities when memory is getting low. Its more likely that poor use of bitmaps or logic in your activities will result in performance slowdowns.

这篇关于如何机器人:noHistory ="真"工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!