I am trying to implement a loader example on Android but can\'t get it to start the loader. I am using the following code. It will hit the \"Create Loader\" but it will never re
If you are using a custom loader, you can save the last data reference, and have it available via a getter. when the user rotates his screen, you can get the loader back from getLoaderManager().getLoader method, and then return back the reference. For my testing I noticed that startLoadering goes all the way to CustomLoader.onLoadFinished but the result is never deliver to activity.onLoadFinished.I suspect the activity reference gets lost upon rotation. By the way the great thing about creating loaders is they are persistent through LoaderManager. Think of it as another flavor of headless fragments.. lol.
Loader loader = getLoaderManager().getLoader(LOADER_ID);
if( loader == null )
{
getLoaderManager().initLoader(LOADER_ID, null, MyActivity.this );
}
else
{
listAdapter.addAll(((CustomLoader) loader).getLastData());
}