Google is committed to advancing racial equity for Black communities. See how.

androidx.activity.result

Classes

ActivityResult

A container for an activity result as obtained form Activity#onActivityResult

ActivityResultLauncher

A launcher for a previously-prepared call to start the process of executing an ActivityResultContract.

ActivityResultRegistry

A registry that stores activity result callbacks for registered calls.

IntentSenderRequest

A request for a androidx.activity.result.contract.ActivityResultContracts.StartIntentSenderForResult Activity Contract.

Extension functions summary

For ActivityResult
operator Int

Destructuring declaration for ActivityResult to provide the requestCode

operator Intent?

Destructuring declaration for ActivityResult to provide the intent

For ActivityResultLauncher
Unit

Convenience method to launch a no-argument registered call without needing to pass in null.

Unit

Convenience method to launch a no-argument registered call without needing to pass in Unit.

For ActivityResultCaller
ActivityResultLauncher<Unit>
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, registry: ActivityResultRegistry, callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

ActivityResultLauncher<Unit>
ActivityResultCaller.registerForActivityResult(contract: ActivityResultContract<I, O>, input: I, callback: (O) -> Unit)

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

Extension functions

component1

operator fun ActivityResult.component1(): Int

Destructuring declaration for ActivityResult to provide the requestCode

Return
the resultCode of the ActivityResult

component2

operator fun ActivityResult.component2(): Intent?

Destructuring declaration for ActivityResult to provide the intent

Return
the intent of the ActivityResult

launch

fun ActivityResultLauncher<Void?>.launch(options: ActivityOptionsCompat? = null): Unit

Convenience method to launch a no-argument registered call without needing to pass in null.

launch

@JvmName("launchUnit") fun ActivityResultLauncher<Unit>.launch(options: ActivityOptionsCompat? = null): Unit

Convenience method to launch a no-argument registered call without needing to pass in Unit.

registerForActivityResult

fun <I, O> ActivityResultCaller.registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    input: I,
    registry: ActivityResultRegistry,
    callback: (O) -> Unit
): ActivityResultLauncher<Unit>

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.

registerForActivityResult

fun <I, O> ActivityResultCaller.registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    input: I,
    callback: (O) -> Unit
): ActivityResultLauncher<Unit>

A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.