问题
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