ActivityResultContract
public
abstract
class
ActivityResultContract
extends Object
java.lang.Object | |
↳ | androidx.activity.result.contract.ActivityResultContract<I, O> |
A contract specifying that an activity can be called with an input of type I and produce an output of type O Makes calling an activity for result type-safe.
See also:
Summary
Nested classes | |
---|---|
class |
ActivityResultContract.SynchronousResult<T>
The wrapper for a result provided in |
Public constructors | |
---|---|
ActivityResultContract()
|
Public methods | |
---|---|
abstract
Intent
|
createIntent(Context context, I input)
Create an intent that can be used for |
SynchronousResult<O>
|
getSynchronousResult(Context context, I input)
An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity. |
abstract
O
|
parseResult(int resultCode, Intent intent)
Convert result obtained from |
Inherited methods | |
---|---|
Public constructors
ActivityResultContract
public ActivityResultContract ()
Public methods
createIntent
public abstract Intent createIntent (Context context, I input)
Create an intent that can be used for Activity.startActivityForResult(Intent, int)
Parameters | |
---|---|
context |
Context |
input |
I |
Returns | |
---|---|
Intent |
getSynchronousResult
public SynchronousResult<O> getSynchronousResult (Context context, I input)
An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.
Parameters | |
---|---|
context |
Context |
input |
I |
Returns | |
---|---|
SynchronousResult<O> |
the result wrapped in a ActivityResultContract.SynchronousResult or null if the call
should proceed to start an activity.
|
parseResult
public abstract O parseResult (int resultCode, Intent intent)
Convert result obtained from Activity.onActivityResult(int, int, Intent)
to O
Parameters | |
---|---|
resultCode |
int |
intent |
Intent |
Returns | |
---|---|
O |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-12-02 UTC.