My problem is basically the same as this one:Sometimes don't get onCreateLoader callback after calling initLoader
I have 2 ListFragments
that are co
I had the same issue as the OP in that onCreateLoader
was not being called after a configuration change. However, that wasn't really the problem (as using getSupportLoaderManager().enableDebugLogging(true);
showed that my loaders were being successfully re-used, so there was no need to recreate new ones).
So I looked into my onLoadFinished(Loader
method and found, unlike onCreateLoader
, it was always called after a configuration change. And the cursor
was being populated each time. :-)
The problem was that the position of the cursor was at the end of the resultset, so my attempts to iterate through it resulted in no action (and, consequentially, my UI not being populated).
The solution that worked was to move the cursor position to back before first:
// Move cursor before first so we can still iterate after config change
cursor.moveToPosition(-1);
I put that at the start of my onLoadFinished
method.