java.lang.Object | |
↳ | com.google.android.gms.tasks.Task<TResult> |
![]()
CancellableTask<TState>
|
![]()
ControllableTask<TState>,
FileDownloadTask,
StorageTask<TResult extends StorageTask.ProvideError>,
StreamDownloadTask,
UploadTask
|
Represents an asynchronous operation.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a listener that is called when the Task completes.
| |||||||||||
Adds an Activity-scoped listener that is called when the Task completes.
| |||||||||||
Adds a listener that is called when the Task completes.
| |||||||||||
Adds an Activity-scoped listener that is called if the Task fails.
| |||||||||||
Adds a listener that is called if the Task fails.
| |||||||||||
Adds a listener that is called if the Task fails.
| |||||||||||
Adds a listener that is called if the Task completes successfully.
| |||||||||||
Adds a listener that is called if the Task completes successfully.
| |||||||||||
Adds an Activity-scoped listener that is called if the Task completes
successfully.
| |||||||||||
Returns a new Task that will be completed with the result of applying the specified
Continuation to this Task.
| |||||||||||
Returns a new Task that will be completed with the result of applying the specified
Continuation to this Task.
| |||||||||||
Returns a new Task that will be completed with the result of applying the specified
Continuation to this Task.
| |||||||||||
Returns a new Task that will be completed with the result of applying the specified
Continuation to this Task.
| |||||||||||
Returns the exception that caused the Task to fail.
| |||||||||||
Gets the result of the Task, if it has already completed.
| |||||||||||
Gets the result of the Task, if it has already completed.
| |||||||||||
Returns
true if the Task is complete; false otherwise. | |||||||||||
Returns
true if the Task has completed successfully; false otherwise. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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.
Parameters | |
---|---|
listener |
OnCompleteListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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
onStop()
.
Parameters | |
---|---|
activity |
Activity
|
listener |
OnCompleteListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
executor |
Executor :
the executor to use to call the listener |
listener |
OnCompleteListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
The listener will be automatically removed during
onStop()
.
Parameters | |
---|---|
activity |
Activity
|
listener |
OnFailureListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
listener |
OnFailureListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
executor |
Executor :
the executor to use to call the listener |
listener |
OnFailureListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
executor |
Executor :
the executor to use to call the listener |
listener |
OnSuccessListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
listener |
OnSuccessListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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
onStop()
.
Parameters | |
---|---|
activity |
Activity
|
listener |
OnSuccessListener
|
Returns | |
---|---|
Task<TResult> |
this Task |
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.
Parameters | |
---|---|
continuation |
Continuation
|
Returns | |
---|---|
Task<TContinuationResult> |
See also:
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
Parameters | |
---|---|
executor |
Executor :
the executor to use to call the Continuation |
continuation |
Continuation
|
Returns | |
---|---|
Task<TContinuationResult> |
See also:
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.
Parameters | |
---|---|
continuation |
Continuation
|
Returns | |
---|---|
Task<TContinuationResult> |
See also:
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
Parameters | |
---|---|
executor |
Executor :
the executor to use to call the Continuation |
continuation |
Continuation
|
Returns | |
---|---|
Task<TContinuationResult> |
See also:
Returns the exception that caused the Task to fail. Returns null
if the Task is not yet complete, or completed successfully.
Returns | |
---|---|
Exception |
Gets the result of the Task, if it has already completed.
Returns | |
---|---|
TResult |
Throws | |
---|---|
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.
Parameters | |
---|---|
exceptionType |
Class
|
Returns | |
---|---|
TResult |
Throws | |
---|---|
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 complete; false
otherwise.
Returns | |
---|---|
boolean |
Returns true
if the Task has completed successfully; false
otherwise.
Returns | |
---|---|
boolean |