[英]Loader not retained and always created on orientation change
I have an Activity A
that contains a Fragment B
that contains a Fragment C
. 我有一个
Activity A
,其中包含一个Fragment B
,其中包含一个Fragment C
Currently, Fragment B
's LoaderManager
manages one CursorLoader
. 当前,
Fragment B
的LoaderManager
管理一个CursorLoader
。 The data is given to Fragment C
. 数据被提供给
Fragment C
On orientation change, the loader is lost: initLoader
always leads to onCreateLoader
being invoked by the system. 更改方向时,加载程序将丢失:
initLoader
始终导致系统调用onCreateLoader
。 However, the documentation says: 但是, 文档说:
If the loader doesn't already exist, one is created and (if the activity/fragment is currently started) starts the loader.
如果该加载器尚不存在,则会创建一个并(如果当前已启动活动/片段)启动该加载器。 Otherwise the last created loader is re-used.
否则,将重新使用最后创建的加载程序。
How do I get this behaviour? 我如何获得这种行为?
It's an open bug, Google is aware and hopefully plan on fixing it 这是一个开放的错误,Google知道并希望计划对其进行修复
https://code.google.com/p/android/issues/detail?id=183783 https://code.google.com/p/android/issues/detail?id=183783
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.