Share via


Loader.CancelLoad Method

Definition

Attempt to cancel the current load task.

[Android.Runtime.Register("cancelLoad", "()Z", "GetCancelLoadHandler")]
public virtual bool CancelLoad ();
[<Android.Runtime.Register("cancelLoad", "()Z", "GetCancelLoadHandler")>]
abstract member CancelLoad : unit -> bool
override this.CancelLoad : unit -> bool

Returns

Returns false if the task could not be canceled, typically because it has already completed normally, or because #startLoading() hasn't been called; returns true otherwise. When true is returned, the task is still running and the OnLoadCanceledListener will be called when the task completes.

Attributes

Remarks

Attempt to cancel the current load task. Must be called on the main thread of the process.

Cancellation is not an immediate operation, since the load is performed in a background thread. If there is currently a load in progress, this method requests that the load be canceled, and notes this is the case; once the background thread has completed its work its remaining state will be cleared. If another load request comes in during this time, it will be held until the canceled load is complete.

Java documentation for android.content.Loader.cancelLoad().

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