Good day, I have a class that implements the LoaderCallbacks, and hence have the unimplemented methods overriden. onCreateLoader(),onLoaderFinshed() and onLoaderReset();
in the Activity onCreate(), i prepare a loader:
getLoaderManager().initLoader(0, null, this);
and in the onCreateLoader(), i have returned a custom loader class here which extends the SimpleLoader class by christain.
Now just wondering, if i do this somewhere in my class outside of the onCreateLoader() method:
CursorLoader loader = new cursorLoader(
this,android.provider.ContactsContract.Contacts.CONTENT_URI, null,null,null,null);
loader.loadInBackground();
//cursor = loader.loadInBackground();
Does the LoaderCallback hold a reference to it and calls onLoadFinished() or is this a different implementation altogether. what does this really mean? Thank you.
Creating a new CursorLoader has nothing to do with the LoaderManager.
Then the
onLoadFinished()method will not be called when creating a new CursorLoader.What if the data changes:
If the data monitored by the Loader changes, the Loader will requery itself. But the
onLoadFinished()will not be called if this Loader hasn’t been supplied to the LoaderManager by theonCreateLoadermethod.To summarise:
Imagine you, or some else process, modify the data you’re monitoring by a Loader.
If this Loader has been supplied to the LoaderManager by the
onCreateLoaderthenonLoadFinished()will be called.If this Loader hasn’t been supplied to the LoaderManager by the
onCreateLoaderthenonLoadFinished()will not be called.