Android Guides | Samples

Android.Content.Loader Class

A class that performs asynchronous loading of data.

See Also: Loader

Syntax

[Android.Runtime.Register("android/content/Loader", DoNotGenerateAcw=true)]
public class Loader : Object

Remarks

A class that performs asynchronous loading of data. While Loaders are active they should monitor the source of their data and deliver new results when the contents change. See LoaderManager for more detail.

Developer Guides

Note on threading: Clients of loaders should as a rule perform any calls on to a Loader from the main thread of their process (that is, the thread the Activity callbacks and other things occur on). Subclasses of Loader (such as AsyncTaskLoader) will often perform their work in a separate thread, but when delivering their results this too should be done on the main thread.

Subclasses generally must implement at least Loader.OnStartLoading, Loader.OnStopLoading, Loader.OnForceLoad, and Loader.OnReset.

Most implementations should not derive directly from this class, but instead inherit from AsyncTaskLoader.

For more information about using loaders, read the Loaders developer guide.

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 11

The members of Android.Content.Loader are listed below.

See Also: Object

Public Constructors

Stores away the application context associated with context.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
ContextContext.
[read-only]
IdInt32.
[read-only]
IsAbandonedBoolean. Return whether this loader has been abandoned.
[read-only]
IsResetBoolean. Return whether this load has been reset.
[read-only]
IsStartedBoolean. Return whether this load has been started.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Abandon()
This function will normally be called for you automatically by LoaderManager when restarting a Loader.
CancelLoad() : Boolean
Attempt to cancel the current load task.
CommitContentChanged()
Commit that you have actually fully processed a content change that was returned by Loader.TakeContentChanged.
DataToString(Object) : String
DeliverCancellation()
Informs the registered NoType:android/content/Loader$OnLoadCanceledListener;Href=../../../reference/android/content/Loader.OnLoadCanceledListener.html that the load has been canceled.
DeliverResult(Object)
Dump(String, FileDescriptor, PrintWriter, String[])
Print the Loader's state into the given stream.
DumpAsync(String, FileDescriptor, PrintWriter, String[]) : Task
ForceLoad()
Force an asynchronous load.
OnContentChanged()
Called when NoType:android/content/Loader$ForceLoadContentObserver;Href=../../../reference/android/content/Loader.ForceLoadContentObserver.html detects a change.
RegisterListener(Int32, Loader+IOnLoadCompleteListener)
RegisterOnLoadCanceledListener(Loader+IOnLoadCanceledListener)
Reset()
This function will normally be called for you automatically by LoaderManager when destroying a Loader.
RollbackContentChanged()
Report that you have abandoned the processing of a content change that was returned by Loader.TakeContentChanged and would like to rollback to the state where there is again a pending content change.
StartLoading()
This function will normally be called for you automatically by LoaderManager when the associated fragment/activity is being started.
StopLoading()
This function will normally be called for you automatically by LoaderManager when the associated fragment/activity is being stopped.
TakeContentChanged() : Boolean
Take the current flag indicating whether the loader's content had changed while it was stopped.
UnregisterListener(Loader+IOnLoadCompleteListener)
UnregisterOnLoadCanceledListener(Loader+IOnLoadCanceledListener)

Protected Methods

OnAbandon()
Subclasses implement this to take care of being abandoned.
OnCancelLoad() : Boolean
Subclasses must implement this to take care of requests to Loader.CancelLoad.
OnForceLoad()
Subclasses must implement this to take care of requests to Loader.ForceLoad.
OnReset()
Subclasses must implement this to take care of resetting their loader, as per Loader.Reset.
OnStartLoading()
Subclasses must implement this to take care of loading their data, as per Loader.StartLoading.
OnStopLoading()
Subclasses must implement this to take care of stopping their loader, as per Loader.StopLoading.