ActivityResultLauncher
abstract class ActivityResultLauncher<I : Any!>
kotlin.Any | |
↳ | androidx.activity.result.ActivityResultLauncher |
A launcher for a previously-ActivityResultCaller#registerForActivityResult to start the process of executing an ActivityResultContract
.
Summary
Public constructors | |
---|---|
<init>() A launcher for a previously-ActivityResultCaller#registerForActivityResult to start the process of executing an |
Public methods | |
---|---|
abstract ActivityResultContract<I, *> |
Get the |
open Unit |
launch(input: I) Executes an |
abstract Unit |
launch(input: I, @Nullable options: ActivityOptionsCompat?) Executes an |
abstract Unit |
Unregisters this launcher, releasing the underlying result callback, and any references captured within it. |
Extension functions | ||||
---|---|---|---|---|
From androidx.activity.result
|
Public constructors
<init>
ActivityResultLauncher()
A launcher for a previously-ActivityResultCaller#registerForActivityResult to start the process of executing an ActivityResultContract
.
Public methods
getContract
@NonNull abstract fun getContract(): ActivityResultContract<I, *>
Get the ActivityResultContract
that was used to create this launcher.
Return | |
---|---|
ActivityResultContract<I, *> |
the contract that was used to create this launcher |
launch
open fun launch(input: I): Unit
Executes an ActivityResultContract
.
This method throws android.content.ActivityNotFoundException
if there was no Activity found to run the given Intent.
Parameters | |
---|---|
input |
I: the input required to execute an ActivityResultContract . |
Exceptions | |
---|---|
android.content.ActivityNotFoundException |
launch
abstract fun launch(
input: I,
@Nullable options: ActivityOptionsCompat?
): Unit
Executes an ActivityResultContract
.
This method throws android.content.ActivityNotFoundException
if there was no Activity found to run the given Intent.
Parameters | |
---|---|
input |
I: the input required to execute an ActivityResultContract . |
options |
ActivityOptionsCompat?: Additional options for how the Activity should be started. |
Exceptions | |
---|---|
android.content.ActivityNotFoundException |
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.