Google 致力于为黑人社区推动种族平等。查看具体举措

ActivityResultContract

abstract class ActivityResultContract<I : Any!, O : Any!>
kotlin.Any
   ↳ androidx.activity.result.contract.ActivityResultContract

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.

Summary

Nested classes

The wrapper for a result provided in getSynchronousResult

Public constructors

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.

Public methods
abstract Intent
createIntent(@NonNull context: Context, input: I)

Create an intent that can be used for Activity#startActivityForResult

open ActivityResultContract.SynchronousResult<O>?
getSynchronousResult(@NonNull context: Context, input: I)

An optional method you can implement that can be used to potentially provide a result in lieu of starting an activity.

abstract O
parseResult(resultCode: Int, @Nullable intent: Intent?)

Convert result obtained from Activity#onActivityResult to O

Public constructors

<init>

ActivityResultContract()

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 ac