LoaderManager.InitLoader Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Ensures a loader is initialized and active.
[Android.Runtime.Register("initLoader", "(ILandroid/os/Bundle;Landroid/app/LoaderManager$LoaderCallbacks;)Landroid/content/Loader;", "GetInitLoader_ILandroid_os_Bundle_Landroid_app_LoaderManager_LoaderCallbacks_Handler")]
[Java.Interop.JavaTypeParameters(new System.String[] { "D" })]
public abstract Android.Content.Loader? InitLoader(int id, Android.OS.Bundle? args, Android.App.LoaderManager.ILoaderCallbacks? callback);
[<Android.Runtime.Register("initLoader", "(ILandroid/os/Bundle;Landroid/app/LoaderManager$LoaderCallbacks;)Landroid/content/Loader;", "GetInitLoader_ILandroid_os_Bundle_Landroid_app_LoaderManager_LoaderCallbacks_Handler")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "D" })>]
abstract member InitLoader : int * Android.OS.Bundle * Android.App.LoaderManager.ILoaderCallbacks -> Android.Content.Loader
Parameters
- id
- Int32
int: A unique identifier for this loader. Can be whatever you want. Identifiers are scoped to a particular LoaderManager instance.
- args
- Bundle
Bundle: Optional arguments to supply to the loader at construction. If a loader already exists (a new one does not need to be created), this parameter will be ignored and the last arguments continue to be used.
- callback
- LoaderManager.ILoaderCallbacks
LoaderCallbacks: Interface the LoaderManager will call to report about changes in the state of the loader. Required.
Returns
- Attributes
Remarks
Ensures a loader is initialized and active. If the loader doesn't already exist, one is created and (if the activity/fragment is currently started) starts the loader. Otherwise the last created loader is re-used. In either case, the given callback is associated with the loader, and will be called as the loader state changes. If at the point of call the caller is in its started state, and the requested loader already exists and has generated its data, then callback LoaderCallbacks.onLoadFinished will be called immediately (inside of this function), so you must be prepared for this to happen.
Android reference for android.app.LoaderManager.initLoader.
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.