欢迎参加我们将于 6 月 3 日举行的 #Android11:Beta 版发布会

ActivityResultLauncher

abstract class ActivityResultLauncher<I : Any!>
kotlin.Any
   ↳ androidx.activity.result.ActivityResultLauncher

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

Summary

Public constructors

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

Public methods

open Unit
launch(input: I)

Executes an ActivityResultContract.

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

Executes an ActivityResultContract.

abstract Unit

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

Extension functions

From androidx.activity.result
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

<init>

ActivityResultLauncher()

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

Public methods

launch

open fun launch(input: I): Unit

Executes an ActivityResultContract.

Parameters
input I: the input required to execute an ActivityResultContract.

launch

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

Executes an ActivityResultContract.

Parameters
input I: the input required to execute an ActivityResultContract.
options ActivityOptionsCompat?: Additional options for how the Activity should be started.

unregister

@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.