Represents an asynchronous operation.
|
Task()
|
| Task<TResult> |
addOnCanceledListener(OnCanceledListener
listener)
Adds a listener that is called if the Task is canceled.
|
| Task<TResult> |
addOnCanceledListener(Executor
executor, OnCanceledListener
listener)
Adds a listener that is called if the Task is canceled.
|
| Task<TResult> |
addOnCanceledListener(Activity
activity, OnCanceledListener
listener)
Adds an Activity-scoped listener that is called if the Task is canceled.
|
| Task<TResult> |
addOnCompleteListener(OnCompleteListener<TResult>
listener)
Adds a listener that is called when the Task completes.
|
| Task<TResult> |
addOnCompleteListener(Activity
activity, OnCompleteListener<TResult>
listener)
Adds an Activity-scoped listener that is called when the Task completes.
|
| Task<TResult> |
addOnCompleteListener(Executor
executor, OnCompleteListener<TResult>
listener)
Adds a listener that is called when the Task completes.
|
| abstract Task<TResult> |
addOnFailureListener(Activity
activity, OnFailureListener
listener)
Adds an Activity-scoped listener that is called if the Task fails.
|
| abstract Task<TResult> | |
| abstract Task<TResult> |
addOnFailureListener(Executor
executor, OnFailureListener
listener)
Adds a listener that is called if the Task fails.
|
| abstract Task<TResult> |
addOnSuccessListener(Executor
executor, OnSuccessListener<? super TResult>
listener)
Adds a listener that is called if the Task completes successfully.
|
| abstract Task<TResult> |
addOnSuccessListener(OnSuccessListener<? super TResult>
listener)
Adds a listener that is called if the Task completes successfully.
|
| abstract Task<TResult> |
addOnSuccessListener(Activity
activity, OnSuccessListener<? super TResult>
listener)
Adds an Activity-scoped listener that is called if the Task completes
successfully.
|
| <TContinuationResult> Task<TContinuationResult> |
continueWith(Continuation<TResult, TContinuationResult>
continuation)
Returns a new Task that will be completed with the result of applying the
specified Continuation to this Task.
|
| <TContinuationResult> Task<TContinuationResult> |
continueWith(Executor
executor, Continuation<TResult, TContinuationResult>
continuation)
Returns a new Task that will be completed with the result of applying the
specified Continuation to this Task.
|
| <TContinuationResult> Task<TContinuationResult> |
continueWithTask(Continuation<TResult, Task<TContinuationResult>>
continuation)
Returns a new Task that will be completed with the result of applying the
specified Continuation to this Task.
|
| <TContinuationResult> Task<TContinuationResult> |
continueWithTask(Executor
executor, Continuation<TResult, Task<TContinuationResult>>
continuation)
Returns a new Task that will be completed with the result of applying the
specified Continuation to this Task.
|
| abstract Exception |
getException()
Returns the exception that caused the Task to fail.
|
| abstract TResult |
getResult()
Gets the result of the Task, if it has already completed.
|
| abstract <X extends Throwable> TResult | |
| abstract boolean |
isCanceled()
Returns
true if the Task is canceled; false
otherwise.
|
| abstract boolean |
isComplete()
Returns
true if the Task is complete; false
otherwise.
|
| abstract boolean |
isSuccessful()
Returns
true if the Task has completed successfully;
false otherwise.
|
| <TContinuationResult> Task<TContinuationResult> |
onSuccessTask(Executor
executor, SuccessContinuation<TResult, TContinuationResult>
successContinuation)
Returns a new Task that will be completed with the result of applying the
specified SuccessContinuation to this Task when this Task completes
successfully.
|
| <TContinuationResult> Task<TContinuationResult> |
onSuccessTask(SuccessContinuation<TResult, TContinuationResult>
successContinuation)
Returns a new Task that will be completed with the result of applying the
specified SuccessContinuation to this Task when this Task completes
successfully.
|
Adds a listener that is called if the Task is canceled.
The listener will be called on main application thread. If the Task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Adds a listener that is called if the Task is canceled.
If the Task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
| executor | the executor to use to call the listener |
|---|---|
| listener |
Adds an Activity-scoped listener that is called if the Task is canceled.
The listener will be called on main application thread. If the Task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during Activity.onStop().
Adds a listener that is called when the Task completes.
The listener will be called on main application thread. If the Task is already complete, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Adds an Activity-scoped listener that is called when the Task completes.
The listener will be called on main application thread. If the Task is already complete, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during Activity.onStop().
Adds a listener that is called when the Task completes.
If the Task is already complete, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
| executor | the executor to use to call the listener |
|---|---|
| listener |
Adds an Activity-scoped listener that is called if the Task fails.
The listener will be called on main application thread. If the Task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
A canceled Task is not a failure Task. This listener will not trigger if the Task is canceled.
The listener will be automatically removed during Activity.onStop().
Adds a listener that is called if the Task fails.
The listener will be called on main application thread. If the Task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
A canceled Task is not a failure Task. This listener will not trigger if the Task is canceled.
Adds a listener that is called if the Task fails.
If the Task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
| executor | the executor to use to call the listener |
|---|---|
| listener |
Adds a listener that is called if the Task completes successfully.
If multiple listeners are added, they will be called in the order in which they were added. If the Task has already completed successfully, a call to the listener will be immediately scheduled.
| executor | the executor to use to call the listener |
|---|---|
| listener |
Adds a listener that is called if the Task completes successfully.
The listener will be called on the main application thread. If the Task has already completed successfully, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
Adds an Activity-scoped listener that is called if the Task completes successfully.
The listener will be called on the main application thread. If the Task has already completed successfully, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.
The listener will be automatically removed during Activity.onStop().
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
The Continuation will be called on the main application thread.
If the previous Task is canceled, the returned Task will also be canceled and the Continuation would not execute.
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
If the previous Task is canceled, the returned Task will also be canceled and the Continuation would not execute.
| executor | the executor to use to call the Continuation |
|---|---|
| continuation |
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
The Continuation will be called on the main application thread.
If the previous Task is canceled, the Continuation would still execute and task.isCanceled() is true can be observed in the Continuation.
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
If the previous Task is canceled, the Continuation would still execute and task.isCanceled() is true can be observed in the Continuation.
| executor | the executor to use to call the Continuation |
|---|---|
| continuation |
Returns the exception that caused the Task to fail. Returns null if the
Task is not yet complete, or completed successfully.
Gets the result of the Task, if it has already completed.
| IllegalStateException | if the Task is not yet complete |
|---|---|
| RuntimeExecutionException | if the Task failed with an exception |
Gets the result of the Task, if it has already completed.
| IllegalStateException | if the Task is not yet complete |
|---|---|
| if the Task failed with an exception of type X | |
| RuntimeExecutionException | if the Task failed with an exception that was not of type X |
| Throwable |
Returns true if the Task is canceled; false otherwise.
Returns true if the Task is complete; false otherwise.
Returns true if the Task has completed successfully; false
otherwise.
Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.
If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.
| executor | the executor to use to call the SuccessContinuation |
|---|---|
| successContinuation |
Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.
The SuccessContinuation will be called on the main application thread.
If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.