Share via


Loader Class

Definition

A class that performs asynchronous loading of data.

[Android.Runtime.Register("android/content/Loader", DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "D" })]
public class Loader : Java.Lang.Object
[<Android.Runtime.Register("android/content/Loader", DoNotGenerateAcw=true)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "D" })>]
type Loader = class
    inherit Object
Inheritance
Loader
Derived
Attributes

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 android.app.LoaderManager for more detail.

<b>Note on threading:</b> 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 #onStartLoading(), #onStopLoading(), #onForceLoad(), and #onReset().

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

<div class="special reference"> <h3>Developer Guides</h3>

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

</div>

This member is deprecated. Use the Support Libraryandroidx.loader.content.Loader

Java documentation for android.content.Loader.

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.

Constructors

Loader(Context)

Stores away the application context associated with context.

Loader(IntPtr, JniHandleOwnership)

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

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Context
Handle

The handle to the underlying Android instance.

(Inherited from Object)
Id
IsAbandoned

Return whether this loader has been abandoned.

IsReset

Return whether this load has been reset.

IsStarted

Return whether this load has been started.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Abandon()

This function will normally be called for you automatically by android.app.LoaderManager when restarting a Loader.

CancelLoad()

Attempt to cancel the current load task.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CommitContentChanged()

Commit that you have actually fully processed a content change that was returned by #takeContentChanged.

DataToString(Object)

For debugging, converts an instance of the Loader's data class to a string that can be printed.

DeliverCancellation()

Informs the registered OnLoadCanceledListener that the load has been canceled.

DeliverResult(Object)

Sends the result of the load to the registered listener.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Dump(String, FileDescriptor, PrintWriter, String[])

Print the Loader's state into the given stream.

DumpAsync(String, FileDescriptor, PrintWriter, String[])
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
ForceLoad()

Force an asynchronous load.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnAbandon()

Subclasses implement this to take care of being abandoned.

OnCancelLoad()

Subclasses must implement this to take care of requests to #cancelLoad().

OnContentChanged()

Called when ForceLoadContentObserver detects a change.

OnForceLoad()

Subclasses must implement this to take care of requests to #forceLoad().

OnReset()

Subclasses must implement this to take care of resetting their loader, as per #reset().

OnStartLoading()

Subclasses must implement this to take care of loading their data, as per #startLoading().

OnStopLoading()

Subclasses must implement this to take care of stopping their loader, as per #stopLoading().

RegisterListener(Int32, Loader+IOnLoadCompleteListener)

Registers a class that will receive callbacks when a load is complete.

RegisterOnLoadCanceledListener(Loader+IOnLoadCanceledListener)

Registers a listener that will receive callbacks when a load is canceled.

Reset()

This function will normally be called for you automatically by android.app.LoaderManager when destroying a Loader.

RollbackContentChanged()

Report that you have abandoned the processing of a content change that was returned by #takeContentChanged() and would like to rollback to the state where there is again a pending content change.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
StartLoading()

This function will normally be called for you automatically by android.app.LoaderManager when the associated fragment/activity is being started.

StopLoading()

This function will normally be called for you automatically by android.app.LoaderManager when the associated fragment/activity is being stopped.

TakeContentChanged()

Take the current flag indicating whether the loader's content had changed while it was stopped.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UnregisterListener(Loader+IOnLoadCompleteListener)

Remove a listener that was previously added with #registerListener.

UnregisterOnLoadCanceledListener(Loader+IOnLoadCanceledListener)

Unregisters a listener that was previously added with #registerOnLoadCanceledListener.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to