Interface Info |
|---|
public interface Task<TResult> Task API. Callback methods registered in this API will be called when task execution is complete. |
Qualifier and Type |
Method Name and Description |
|---|---|
Task<TResult> |
addOnCompleteListener(OnCompleteListener<TResult> onCompleteListener) Adds one or more listeners that will be called in the main thread upon task completion. Multiple listeners added will be called in the order in which they were added. |
Task<TResult> |
addOnFailureListener(OnFailureListener onFailureListener) Adds one or more listeners that will be called in the main thread upon task execution failure. Multiple listeners added will be called in the order in which they were added. |
Task<TResult> |
addOnSuccessListener(OnSuccessListener<TResult> onSuccessListener) Adds one or more listeners that will be called in the main thread when a task is successfully executed. Multiple listeners added will be called in the order in which they were added. |
Exception |
Obtains the exception that causes the task execution failure. |
TResult |
Obtains the execution result of a task if it is completed. |
boolean |
Checks whether a task is canceled. The true value is returned if a task is canceled; false otherwise. |
boolean |
Checks whether a task is completed. The true value is returned if a task is completed; false otherwise. |
boolean |
Checks whether a task is executed successfully. The true value is returned if a task is executed successfully; false otherwise. |
Method |
|---|
public Task<TResult> addOnCompleteListener(OnCompleteListener<TResult> onCompleteListener) Adds one or more listeners that will be called in the main thread upon task completion. Multiple listeners added will be called in the order in which they were added. |
Parameters
Name |
Description |
|---|---|
onCompleteListener |
Listener, which is called upon task completion. |
Returns
Type |
Description |
|---|---|
Task<TResult> |
Task execution result. |
Method |
|---|
public Task<TResult> addOnFailureListener(OnFailureListener onFailureListener) Adds one or more listeners that will be called in the main thread upon task execution failure. Multiple listeners added will be called in the order in which they were added. |
Parameters
Name |
Description |
|---|---|
onFailureListener |
Listener, which is called when a task failed to be executed. |
Returns
Type |
Description |
|---|---|
Task<TResult> |
Task execution result. |
Method |
|---|
public Task<TResult> addOnSuccessListener(OnSuccessListener<TResult> onSuccessListener) Adds one or more listeners that will be called in the main thread upon task execution success. Multiple listeners added will be called in the order in which they were added. |
Parameters
Name |
Description |
|---|---|
onSuccessListener |
Listener, which is called when a task was executed successfully. |
Returns
Type |
Description |
|---|---|
Task<TResult> |
Task execution result. |
Method |
|---|
public Exception getException() Obtains the exception that causes the task execution failure. |
Returns
Type |
Description |
|---|---|
Exception |
Exception that causes the task execution failure. |
Method |
|---|
public TResult getResult() Obtains the execution result of a task if it is completed. |
Returns
Type |
Description |
|---|---|
TResult |
Result of the task. |
Method |
|---|
public boolean isCanceled() Checks whether a task is canceled. The true value is returned if a task is canceled; false otherwise. |
Returns
Type |
Description |
|---|---|
boolean |
true if the task is canceled; false otherwise. |