ActivityResultCaller
interface ActivityResultCaller
androidx.activity.result.ActivityResultCaller |
A class that can call Activity#startActivityForResult-style APIs without having to manage request codes, and converting request/response to an Intent
Summary
Public methods | |
---|---|
abstract ActivityResultLauncher<I> |
registerForActivityResult(@NonNull contract: ActivityResultContract<I, O>, @NonNull callback: ActivityResultCallback<O>) Register a request to Activity#startActivityForResult, designated by the given |
abstract ActivityResultLauncher<I> |
registerForActivityResult(@NonNull contract: ActivityResultContract<I, O>, @NonNull registry: ActivityResultRegistry, @NonNull callback: ActivityResultCallback<O>) Register a request to Activity#startActivityForResult, designated by the given |
Extension functions | ||||
---|---|---|---|---|
From androidx.activity.result
|
Public methods
registerForActivityResult
@NonNull abstract fun <I : Any!, O : Any!> registerForActivityResult(
@NonNull contract: ActivityResultContract<I, O>,
@NonNull callback: ActivityResultCallback<O>
): ActivityResultLauncher<I>
Register a request to Activity#startActivityForResult, designated by the given contract
. This creates a record in the registry
associated wit this caller, managing request code, as well as conversions to/from Intent
under the hood. This *must* be called unconditionally, as part of initialization path, typically as a field initializer of an Activity or Fragment.
Parameters | |
---|---|
<I> |
the type of the input(if any) required to call the activity |
<O> |
the type of output returned as |