ActivityResultLauncher
public abstract class ActivityResultLauncher<I extends Object>
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 |
|---|
<I extends Object> ActivityResultLauncher() |
Public methods |
|
|---|---|
abstract @NonNull ActivityResultContract<@NonNull I, @NonNull ?> |
Returns the |
void |
Executes an |
abstract void |
launch(@NonNull I input, ActivityOptionsCompat options)Executes an |
abstract void |
Unregisters this launcher, releasing the underlying result callback, and any references captured within it. |
Extension functions |
|
|---|---|
final void |
ActivityResultLauncherKt.launch(Convenience method to launch a no-argument registered call without needing to pass in |
final void |
ActivityResultLauncherKt.launch(Convenience method to launch a no-argument registered call without needing to pass in |
Public constructors
Public methods
getContract
public abstract @NonNull ActivityResultContract<@NonNull I, @NonNull ?> getContract()
Returns the ActivityResultContract that was used to create this launcher.
launch
public void launch(@NonNull I input)
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
public abstract void launch(@NonNull I input, ActivityOptionsCompat options)
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
@MainThread
public abstract void unregister()
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.
Extension functions
ActivityResultLauncherKt.launch
public final void ActivityResultLauncherKt.launch(
@NonNull ActivityResultLauncher<Void> receiver,
ActivityOptionsCompat options
)
Convenience method to launch a no-argument registered call without needing to pass in null.
ActivityResultLauncherKt.launch
public final void ActivityResultLauncherKt.launch(
@NonNull ActivityResultLauncher<Unit> receiver,
ActivityOptionsCompat options
)
Convenience method to launch a no-argument registered call without needing to pass in Unit.