Loader not retained and always created on orientation change

老子叫甜甜 提交于 2019-12-13 05:07:25

问题


I have an Activity A that contains a Fragment B that contains a Fragment C.

Currently, Fragment B's LoaderManager manages one CursorLoader. The data is given to Fragment C.

On orientation change, the loader is lost: initLoader always leads to onCreateLoader being invoked by the system. 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?


回答1:


It's an open bug, Google is aware and hopefully plan on fixing it

https://code.google.com/p/android/issues/detail?id=183783



来源:https://stackoverflow.com/questions/32614189/loader-not-retained-and-always-created-on-orientation-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!