简体   繁体   English

Android一般导航问题

[英]Android general navigation issues

I have a general question about navigation especially when it comes to the action bar. 我对导航特别是在操作栏方面有一个一般性的问题。 The main issue I am having is that each time someone navigates away using the action bar it keeps that activity in the stack (unless I pass the intent flags to remove it). 我遇到的主要问题是,每次有人使用操作栏导航离开时,它都会将该活动保留在堆栈中(除非我通过意图标志将其删除)。 Is that standard procedure? 那是标准程序吗? Is it normal to have say 100 instances of one activity? 一个活动说100次实例是正常的吗? If so, how are those activities garbage collected? 如果是这样,这些活动如何被垃圾收集? Further, what is best practice if those activities contain images (ie: images are also kept in memory and duplicated)? 此外,如果这些活动包含图像(即,图像也保存在内存中并重复),则最佳实践是什么?

If you're talking about using the up button properly, you can use (or at least see) NavUtils.navigateUpFromSameTask(Activity) . 如果您在谈论正确使用向上按钮,则可以使用(或至少看到) NavUtils.navigateUpFromSameTask(Activity) It will set the right flags that won't duplicate the activity. 它将设置不会复制活动的正确标志。

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

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