ActivityResultLauncher


abstract class ActivityResultLauncher<I : Any?>

Known direct subclasses
ManagedActivityResultLauncher

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


A launcher for a previously-prepared call to start the process of executing an ActivityResultContract that takes an I as its required input.

Summary

Public constructors

Public functions

open Unit
launch(input: I)

Executes an ActivityResultContract given the required input.

abstract Unit
launch(input: I, options: ActivityOptionsCompat?)

Executes an ActivityResultContract given the required input and optional options for how the Activity should be started.

abstract Unit

Unregisters this launcher, releasing the underlying result callback, and any references captured within it.

Public properties

abstract ActivityResultContract<I, *>

Returns the ActivityResultContract that was used to create this launcher.

Extension functions

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.

Public constructors

ActivityResultLauncher

<I : Any?> ActivityResultLauncher()

Public functions

launch

Added in 1.2.0
open fun launch(input: I): Unit

Executes an ActivityResultContract given the required input.

This method throws android.content.ActivityNotFoundException if there was no Activity found to run the given Intent.

launch

Added in 1.2.0
abstract fun launch(input: I, options: ActivityOptionsCompat?): Unit

Executes an ActivityResultContract given the required input and optional options for how the Activity should be started.

This method throws android.content.ActivityNotFoundException if there was no Activity found to run the given Intent.

unregister

Added in 1.2.0
@MainThread
abstract fun unregister(): Unit

Unregisters this launcher, releasing the underlying result callback, and any references captured within it.

You should call this if the registry may live longer than the callback registered for this launcher.

Public properties

contract

Added in 1.2.0
abstract val contractActivityResultContract<I, *>

Returns the ActivityResultContract that was used to create this launcher.

Extension functions

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

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

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

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