AsyncTaskLoader
abstract class AsyncTaskLoader<D : Any!> : Loader<D>
Static library support version of the framework's android.content.AsyncTaskLoader
. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.
Summary
Public methods |
open Unit |
Called on the main thread to abort a load in progress.
|
open Unit |
|
open Boolean |
Returns true if the current invocation of loadInBackground is being canceled.
|
abstract D? |
Called on a worker thread to perform the actual load and to return the result of the load operation.
|
open Unit |
Called if the task was canceled before it was completed.
|
open Unit |
Set amount to throttle updates by.
|
Inherited functions |
From class Loader
Unit |
abandon()
This function will normally be called for you automatically by LoaderManager when restarting a Loader. When using a Loader with LoaderManager , you must not call this method yourself, or you will conflict with its management of the Loader. Tell the Loader that it is being abandoned. This is called prior to reset to have it retain its current data but not report any new data.
Must be called from the process's main thread.
|
Boolean |
cancelLoad()
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.
|
Unit |
commitContentChanged()
Commit that you have actually fully processed a content change that was returned by takeContentChanged . This is for use with rollbackContentChanged() to handle situations where a load is cancelled. Call this when you have completely processed a load without it being cancelled.
|
String |
dataToString(@Nullable data: D?)
For debugging, converts an instance of the Loader's data class to a string that can be printed. Must handle a null data.
|
Unit |
deliverCancellation()
Informs the registered OnLoadCanceledListener that the load has been canceled. Should only be called by subclasses. Must be called from the process's main thread.
|
Unit |
deliverResult(@Nullable data: D?)
Sends the result of the load to the registered listener. Should only be called by subclasses. Must be called from the process's main thread.
|
Unit |
forceLoad()
Force an asynchronous load. Unlike startLoading() this will ignore a previously loaded data set and load a new one. This simply calls through to the implementation's onForceLoad() . You generally should only call this when the loader is started -- that is, isStarted() returns true.
Must be called from the process's main thread.
|
Context |
getContext()
|
Int |
getId()
|
Boolean |
isAbandoned()
Return whether this loader has been abandoned. In this state, the loader must not report any new data, and must keep its last reported data valid until it is finally reset.
|
Boolean |
isReset()
Return whether this load has been reset. That is, either the loader has not yet been started for the first time, or its reset() has been called.
|
Boolean |
isStarted()
Return whether this load has been started. That is, its startLoading() has been called and no calls to
| |