Fragment 保留的内存
当我像这样调用 popBackStack
时:
manager.popBackStack("mybackstack", FragmentManager.POP_BACK_STACK_INCLUSIVE);
属于“mybackstack”的片段保留的内存将被释放吗?
我有一个管理 ListFragment
的 FragmentActivity
。每次我单击项目时,FragmentActivity
都会实例化一个新的 Fragment
,其中显示有关单击的项目的一些信息,然后显示带有位图的 DialogFragment
(当对话框关闭时我会回收)。我将 android:configChanges="orientation"
放入清单中,并根据需要重写 onConfigurationChanged
。
When I call the popBackStack
like:
manager.popBackStack("mybackstack", FragmentManager.POP_BACK_STACK_INCLUSIVE);
will the memory retained by the fragments that belongs to "mybackstack" will be freed?
I have a FragmentActivity
that manages a ListFragment
. Every time I click on item, the FragmentActivity
instantiates a new Fragment
which shows some information about the item clicked and then shows a DialogFragment
with a Bitmap (that I recycle when the dialog is dismissed). I put the android:configChanges="orientation"
in the manifest and override onConfigurationChanged
as necessary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,片段保留的内存将被释放。从文档来看,
和,
但请注意,不能保证该内存会立即被释放。
Yes, the memory retained by the fragments will be freed. From the documentation,
and,
Note, however, that there is no guarantee that this memory will be freed immediately.