ApiTaskResult
Stay organized with collections
Save and categorize content based on your preferences.
A representation of the result of a Task
, which includes
additional information about the outcome of the execution.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Public Constructors
public
ApiTaskResult
( Status
status)
Creates an instance of ApiTaskResult
for situations when the Task
fails to
return a result.
Parameters
status
a Status
object contains information about the cause of the failure.
public
ApiTaskResult
(T result, Status
status)
Public Methods
public T
getResult
()
Returns the result of the task.
Returns
- The result of the task, only present if the task completed successfully.
public Status
getStatus
()
Returns the status of the task.
Returns
- The status of the task with information about the result of the operation.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eApiTaskResult\u003c/code\u003e represents the result of a \u003ccode\u003eTask\u003c/code\u003e, including success status and any returned data.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to retrieve the result (\u003ccode\u003egetResult()\u003c/code\u003e) and the status (\u003ccode\u003egetStatus()\u003c/code\u003e) of the task.\u003c/p\u003e\n"],["\u003cp\u003eTwo constructors allow creation with or without a result, depending on task success.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e object gives details about the operation's outcome, particularly in cases of failure.\u003c/p\u003e\n"]]],["`ApiTaskResult` represents the outcome of a `Task`, providing details about its execution. It can be instantiated with a `Status` object alone, indicating a failed task, or with both a result and a `Status`, indicating the task's success or failure. Key actions include retrieving the task's result via `getResult()` and its execution status via `getStatus()`. Additionally the object has a toString method which can be used. inherited methods are also shown, including methods such as clone, equals and wait.\n"],null,["# ApiTaskResult\n\npublic class **ApiTaskResult** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nA representation of the result of a [Task](/android/reference/com/google/android/gms/tasks/Task), which includes\nadditional information about the outcome of the execution. \n\n### Public Constructor Summary\n\n|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult#ApiTaskResult(com.google.android.gms.common.api.Status))([Status](/android/reference/com/google/android/gms/common/api/Status) status) Creates an instance of [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult) for situations when the [Task](/android/reference/com/google/android/gms/tasks/Task) fails to return a result. |\n| | [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult#ApiTaskResult(T,%20com.google.android.gms.common.api.Status))(T result, [Status](/android/reference/com/google/android/gms/common/api/Status) status) Creates an instance of [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult) with a result and a status. |\n\n### Public Method Summary\n\n|-----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| T | [getResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult#getResult())() Returns the result of the task. |\n| [Status](/android/reference/com/google/android/gms/common/api/Status) | [getStatus](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult#getStatus())() Returns the status of the task. |\n| [String](//developer.android.com/reference/java/lang/String.html) | [toString](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult#toString())() |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **ApiTaskResult** ([Status](/android/reference/com/google/android/gms/common/api/Status) status)\n\nCreates an instance of [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult)\nfor situations when the [Task](/android/reference/com/google/android/gms/tasks/Task) fails to\nreturn a result. \n\n##### Parameters\n\n| status | a [Status](/android/reference/com/google/android/gms/common/api/Status) object contains information about the cause of the failure. |\n|--------|-------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public **ApiTaskResult** (T result, [Status](/android/reference/com/google/android/gms/common/api/Status) status)\n\nCreates an instance of [ApiTaskResult](/android/reference/com/google/android/gms/wallet/contract/ApiTaskResult)\nwith a result and a status. \n\n##### Parameters\n\n| result | the result of the task. |\n| status | a [Status](/android/reference/com/google/android/gms/common/api/Status) object with information about the operation. |\n|--------|----------------------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public T **getResult** ()\n\nReturns the result of the task. \n\n##### Returns\n\n- The result of the task, only present if the task completed successfully. \n\n#### public [Status](/android/reference/com/google/android/gms/common/api/Status)\n**getStatus** ()\n\nReturns the status of the task. \n\n##### Returns\n\n- The status of the task with information about the result of the operation. \n\n#### public [String](//developer.android.com/reference/java/lang/String.html) **toString** ()"]]