LoaderManager.ILoaderCallbacks.OnLoadFinished(Loader, Object) Method

Definition

Called when a previously created loader has finished its load.

[Android.Runtime.Register("onLoadFinished", "(Landroid/content/Loader;Ljava/lang/Object;)V", "GetOnLoadFinished_Landroid_content_Loader_Ljava_lang_Object_Handler:Android.App.LoaderManager/ILoaderCallbacksInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void OnLoadFinished (Android.Content.Loader? loader, Java.Lang.Object? data);
[<Android.Runtime.Register("onLoadFinished", "(Landroid/content/Loader;Ljava/lang/Object;)V", "GetOnLoadFinished_Landroid_content_Loader_Ljava_lang_Object_Handler:Android.App.LoaderManager/ILoaderCallbacksInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnLoadFinished : Android.Content.Loader * Java.Lang.Object -> unit

Parameters

loader
Loader

The Loader that has finished.

data
Object

The data generated by the Loader.

Attributes

Remarks

Called when a previously created loader has finished its load. Note that normally an application is <em>not</em> allowed to commit fragment transactions while in this call, since it can happen after an activity's state is saved. See FragmentManager#beginTransaction() 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:

<ul> <li>

The Loader will monitor for changes to the data, and report them to you through new calls here. You should not monitor the data yourself. For example, if the data is a android.database.Cursor and you place it in a android.widget.CursorAdapter, use the android.widget.CursorAdapter#CursorAdapter(android.content.Context, android.database.Cursor, int) constructor <em>without</em> passing in either android.widget.CursorAdapter#FLAG_AUTO_REQUERY or android.widget.CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER (that is, use 0 for the flags argument). This prevents the CursorAdapter from doing its own observing of the Cursor, which is not needed since when a change happens you will get a new Cursor throw another call here. <li> The Loader will release the data once it knows the application is no longer using it. For example, if the data is a android.database.Cursor from a android.content.CursorLoader, you should not call close() on it yourself. If the Cursor is being placed in a android.widget.CursorAdapter, you should use the android.widget.CursorAdapter#swapCursor(android.database.Cursor) method so that the old Cursor is not closed. </ul>

Java documentation for android.app.LoaderManager.LoaderCallbacks.onLoadFinished(android.content.Loader<D>, D).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to