androidx.activity.result
Interfaces
ActivityResultCallback |
A type-safe callback to be called when an |
ActivityResultCaller |
A class that can call |
ActivityResultRegistryOwner |
A class that has an |
Classes
ActivityResult |
A container for an activity result as obtained from |
ActivityResultLauncher |
A launcher for a previously- |
ActivityResultRegistry |
A registry that stores |
IntentSenderRequest |
A request for a |
IntentSenderRequest.Builder |
A builder for constructing |
PickVisualMediaRequest |
A request for a |
PickVisualMediaRequest.Builder |
A builder for constructing |
Top-level functions summary
Extension functions summary
operator Int |
Destructuring declaration for |
operator Intent? |
Destructuring declaration for |
Unit |
ActivityResultLauncher<Void?>.launch(options: ActivityOptionsCompat?)Convenience method to launch a no-argument registered call without needing to pass in |
Unit |
ActivityResultLauncher<Unit>.launch(options: ActivityOptionsCompat?)Convenience method to launch a no-argument registered call without needing to pass in |
ActivityResultLauncher<Unit> |
<I : Any?, O : Any?> ActivityResultCaller.registerForActivityResult(A version of |
ActivityResultLauncher<Unit> |
<I : Any?, O : Any?> ActivityResultCaller.registerForActivityResult(A version of |
Top-level functions
PickVisualMediaRequest
fun PickVisualMediaRequest(
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo,
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems(),
isOrderedSelection: Boolean = false,
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab
): PickVisualMediaRequest
Creates a request for a androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia or androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia Activity Contract.
| Parameters | |
|---|---|
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo |
type to go into the PickVisualMediaRequest |
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems() |
limit the number of selectable items when using |
isOrderedSelection: Boolean = false |
whether the user can control the order of selected media when using |
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab |
the tab to initially open the picker in (defaults to |
| Returns | |
|---|---|
PickVisualMediaRequest |
a PickVisualMediaRequest that contains the given input |
PickVisualMediaRequest
fun PickVisualMediaRequest(
accentColor: Long,
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo,
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems(),
isOrderedSelection: Boolean = false,
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab
): PickVisualMediaRequest
Creates a request for a androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia or androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia Activity Contract.
| Parameters | |
|---|---|
accentColor: Long |
color long to customize picker accent color. Note that the support for this parameter was added in API level 35 / R ext 12 and applies the default behavior for older versions. Also see |
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo |
type to go into the PickVisualMediaRequest |
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems() |
limit the number of selectable items when using |
isOrderedSelection: Boolean = false |
whether the user can control the order of selected media when using |
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab |
the tab to initially open the picker in (defaults to |
| Returns | |
|---|---|
PickVisualMediaRequest |
a PickVisualMediaRequest that contains the given input |
PickVisualMediaRequest
@RequiresApi(value = 33)
fun PickVisualMediaRequest(
mediaCapabilitiesForTranscoding: ActivityResultContracts.PickVisualMedia.MediaCapabilities?,
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo,
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems(),
isOrderedSelection: Boolean = false,
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab
): PickVisualMediaRequest
Creates a request for a androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia or androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia Activity Contract.
| Parameters | |
|---|---|
mediaCapabilitiesForTranscoding: ActivityResultContracts.PickVisualMedia.MediaCapabilities? |
the |
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo |
type to go into the PickVisualMediaRequest |
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems() |
limit the number of selectable items when using |
isOrderedSelection: Boolean = false |
whether the user can control the order of selected media when using |
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab |
the tab to initially open in the picker (defaults to |
| Returns | |
|---|---|
PickVisualMediaRequest |
a PickVisualMediaRequest that contains the given input |
PickVisualMediaRequest
@RequiresApi(value = 33)
fun PickVisualMediaRequest(
mediaCapabilitiesForTranscoding: ActivityResultContracts.PickVisualMedia.MediaCapabilities?,
accentColor: Long,
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo,
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems(),
isOrderedSelection: Boolean = false,
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab
): PickVisualMediaRequest
Creates a request for a androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia or androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia Activity Contract.
| Parameters | |
|---|---|
mediaCapabilitiesForTranscoding: ActivityResultContracts.PickVisualMedia.MediaCapabilities? |
the |
accentColor: Long |
color long to customize picker accent color |
mediaType: ActivityResultContracts.PickVisualMedia.VisualMediaType = ImageAndVideo |
type to go into the PickVisualMediaRequest |
maxItems: @IntRange(from = 2) Int = PickMultipleVisualMedia.getMaxItems() |
limit the number of selectable items when using |
isOrderedSelection: Boolean = false |
whether the user can control the order of selected media when using |
defaultTab: ActivityResultContracts.PickVisualMedia.DefaultTab = DefaultTab.PhotosTab |
the tab to initially open in the picker (defaults to |
| Returns | |
|---|---|
PickVisualMediaRequest |
a PickVisualMediaRequest that contains the given input |
Extension functions
component1
operator fun ActivityResult.component1(): Int
Destructuring declaration for ActivityResult to provide the requestCode
| Returns | |
|---|---|
Int |
the resultCode of the |
component2
operator fun ActivityResult.component2(): Intent?
Destructuring declaration for ActivityResult to provide the intent
| Returns | |
|---|---|
Intent? |
the intent of the |
launch
fun ActivityResultLauncher<Void?>.launch(
options: ActivityOptionsCompat? = null
): Unit
Convenience method to launch a no-argument registered call without needing to pass in null.
launch
fun ActivityResultLauncher<Unit>.launch(
options: ActivityOptionsCompat? = null
): Unit
Convenience method to launch a no-argument registered call without needing to pass in Unit.
registerForActivityResult
fun <I : Any?, O : Any?> ActivityResultCaller.registerForActivityResult(
contract: ActivityResultContract<I, O>,
input: I,
callback: (O) -> Unit
): ActivityResultLauncher<Unit>
A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.
| See also | |
|---|---|
registerForActivityResult |
registerForActivityResult
fun <I : Any?, O : Any?> ActivityResultCaller.registerForActivityResult(
contract: ActivityResultContract<I, O>,
input: I,
registry: ActivityResultRegistry,
callback: (O) -> Unit
): ActivityResultLauncher<Unit>
A version of ActivityResultCaller.registerForActivityResult that additionally takes an input right away, producing a launcher that doesn't take any additional input when called.
| See also | |
|---|---|
registerForActivityResult |