Added in API level 11
Deprecated in API level 28

LoaderCallbacks


interface LoaderCallbacks<D : Any!>
android.app.LoaderManager.LoaderCallbacks

Callback interface for a client to interact with the manager.

Summary

Public methods
abstract Loader<D>!
onCreateLoader(id: Int, args: Bundle!)

Instantiate and return a new Loader for the given ID.

abstract Unit
onLoadFinished(loader: Loader<D>!, data: D)

Called when a previously created loader has finished its load.

abstract Unit
onLoaderReset(loader: Loader<D>!)

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

Public methods

onCreateLoader

Added in API level 11
abstract fun onCreateLoader(
    id: Int,
    args: Bundle!
): Loader<D>!

Deprecated: Deprecated in Java.

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.
Return
Loader<D>! Return a new Loader instance that is ready to start loading.

onLoadFinished

Added in API level 11
abstract fun onLoadFinished(
    loader: Loader<D>!,
    data: D
): Unit

Deprecated: Deprecated in Java.

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<D>!: The Loader that has finished.
data D: The data generated by the Loader.

onLoaderReset

Added in API level 11
abstract fun onLoaderReset(loader: Loader<D>!): Unit

Deprecated: Deprecated in Java.

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<D>!: The Loader that is being reset.