TaskResultContracts.UnpackApiTaskResult
A contract that takes a Task
<T>
and optionally returns its result T?
if the task completes successfully.
Supports contracts that are only interested in receiving the result without any associated
information about the operation.
Public Constructor Summary
Inherited Method Summary
From class
androidx.activity.result.contract.ActivityResultContract
abstract Intent
|
|
SynchronousResult<T> |
|
abstract T |
parseResult(int arg0, Intent
arg1)
|
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Constructors
public UnpackApiTaskResult ()
Protected Methods
protected T outputFromTask (Task<T>
task)
Extracts a result from a given Task
if it is
completed successfully.
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.
[null,null,["Last updated 2024-10-31 UTC."],[[["`TaskResultContracts.UnpackApiTaskResult` is an abstract class that simplifies the handling of `Task` results in Android development."],["It provides a mechanism to extract the result (`T`) from a `Task\u003cT\u003e` if the task completes successfully."],["This contract is useful for scenarios where only the result of the task matters, without needing additional context or operation details."],["`TaskResultContracts.GetPaymentData` is a direct subclass that exemplifies this usage by specifically returning a `PaymentData` object from a task."]]],["`TaskResultContracts.UnpackApiTaskResult` is an abstract contract that handles a `Task\u003cT\u003e` and returns its result `T` upon successful completion. It supports contracts needing only the result, without operation details. The class has a constructor and a protected `outputFromTask` method that extracts the result from a completed `Task`. It inherits from `ResolveApiTaskResult` and includes subclasses like `GetPaymentData`, which returns a `PaymentData` object. The class also supports `createIntent` and `getSynchronousResult`.\n"]]