Skip to content

Most visited

Recently visited

navigation
added in version 22.0.0

LoaderManager.LoaderCallbacks

public static interface LoaderManager.LoaderCallbacks

android.support.v4.app.LoaderManager.LoaderCallbacks<D>


Callback interface for a client to interact with the manager.

Summary

Public methods

abstract Loader<D> onCreateLoader(int id, Bundle args)

Instantiate and return a new Loader for the given ID.

abstract void onLoadFinished(Loader<D> loader, D data)

Called when a previously created loader has finished its load.

abstract void onLoaderReset(Loader<D> loader)

Called when a previously created loader is being reset, and thus making its data unavailable.

Public methods

onCreateLoader

added in version 22.0.0
Loader<D> onCreateLoader (int id, 
                Bundle args)

Instantiate and return a new Loader for the given ID.

Parameters
id int: The ID whose loader is to be created.

args Bundle: Any arguments supplied by the caller.

Returns
Loader<D> Return a new Loader instance that is ready to start loading.

onLoadFinished

added in version 22.0.0
void onLoadFinished (Loader<D> loader, 
                D data)

Called when a previously created loader has finished its load. Note that normally an application is not allowed to commit fragment transactions while in this call, since it can happen after an activity's state is saved. See FragmentManager.openTransaction() for further discussion on this.

This function is guaranteed to be called prior to the release of the last data that was supplied for this Loader. At this point you should remove all use of the old data (since it will be released soon), but should not do your own release of the data since its Loader owns it and will take care of that. The Loader will take care of management of its data so you don't have to. In particular:

Parameters
loader Loader: The Loader that has finished.

data D: The data generated by the Loader.

onLoaderReset

added in version 22.0.0
void onLoaderReset (Loader<D> loader)

Called when a previously created loader is being reset, and thus making its data unavailable. The application should at this point remove any references it has to the Loader's data.

Parameters
loader Loader: The Loader that is being reset.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)