# PickVisualMediaRequest.Builder

Artifact: [androidx.photopicker:photopicker-activity](https://developer.android.com/jetpack/androidx/releases/photopicker) [View Source](https://cs.android.com/search?q=file:androidx/photopicker/activity/PickVisualMediaRequest.kt+class:androidx.photopicker.activity.PickVisualMediaRequest.Builder) Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

*** ** * ** ***


```
class PickVisualMediaRequest.Builder
```

<br />

*** ** * ** ***

A builder for constructing `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#build()()` Build the PickVisualMediaRequest specified by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setAccentColor(kotlin.Long)(accentColor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Set the accent color for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setDefaultTab(androidx.photopicker.activity.PickVisualMedia.DefaultTab)(defaultTab: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.DefaultTab)` Set the default tab for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setHighlightAlbumParams(androidx.photopicker.activity.params.HighlightAlbumParams)(highlightAlbumParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/HighlightAlbumParams?)` Sets parameters for highlighting a specific album's media in the photo picker. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setHighlightSearchResultsParams(androidx.photopicker.activity.params.HighlightSearchResultsParams)( highlightSearchResultsParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/HighlightSearchResultsParams? )` Sets parameters for highlighting search results in the photo picker. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setLocationMetadataAccessRequested(kotlin.Boolean)( isLocationMetadataAccessRequested: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Sets whether the caller requests access to location metadata for the selected media items. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setMaxItems(kotlin.Int)(maxItems: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Limit the number of selectable items in the photo picker when using `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickMultipleVisualMedia` |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 33) https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setMediaCapabilitiesForTranscoding(androidx.photopicker.activity.PickVisualMedia.MediaCapabilities)( mediaCapabilities: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.MediaCapabilities? )` Set the media capabilities for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setMediaType(androidx.photopicker.activity.PickVisualMedia.VisualMediaType)(mediaType: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.VisualMediaType)` Set the media type for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setOrderedSelection(kotlin.Boolean)(isOrderedSelection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set the ordered selection for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresExtension(extension = 34, version = 22) https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setSelectionParams(androidx.photopicker.activity.params.SelectionParams)(selectionParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/SelectionParams?)` Sets selection constraints for media items in the photo picker. |
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder#setUiCustomizationParams(androidx.photopicker.activity.params.UiCustomizationParams)(uiCustomizationParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/UiCustomizationParams?)` |

## Public constructors

### Builder

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
Builder()
```

## Public functions

### build

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun build(): PickVisualMediaRequest
```

Build the PickVisualMediaRequest specified by this builder.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest` | the newly constructed PickVisualMediaRequest. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if both search results highlight and album highlight parameters are set. |

### setAccentColor

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setAccentColor(accentColor: Long): PickVisualMediaRequest.Builder
```

Set the accent color for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`.

The accent color is used to change the main color in the photo picker. This feature was added in API level 35 / R ext 12 and applies the default behavior for older versions.

| Parameters |
|---|---|
| `accentColor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | color long to apply as accent to the main color in the picker |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_PICK_IMAGES_ACCENT_COLOR` |   |

### setDefaultTab

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setDefaultTab(defaultTab: PickVisualMedia.DefaultTab): PickVisualMediaRequest.Builder
```

Set the default tab for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`.

The default tab is used to open the preferred view inside the photo picker at first such as, e.g. `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.DefaultTab.PhotosTab`, `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.DefaultTab.AlbumsTab`. This feature was added in API level 35 / R ext 12 and applies the default behavior for older versions.

| Parameters |
|---|---|
| `defaultTab: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.DefaultTab` | the tab to launch the picker in (defaults to `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.DefaultTab.PhotosTab`) |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_PICK_IMAGES_LAUNCH_TAB` |   |

### setHighlightAlbumParams

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setHighlightAlbumParams(highlightAlbumParams: HighlightAlbumParams?): PickVisualMediaRequest.Builder
```

Sets parameters for highlighting a specific album's media in the photo picker.

This allows apps to highlight media results of an album in the photo picker UI whenever feasible based on the given input album (one of `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/HighlightAlbumParams.Companion.HighlightAlbum`). Only one of search results highlight or album highlight can be specified to either show a highlighted media section when the photopicker launches or to open the photopicker to show a highlighted media results grid based on the given input album. Specifying both album and search highlight will result in throwing `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html`.

This feature was added in Android Tiramisu (API level 33 / T ext 19) and will be ignored on Android R and S.

| Parameters |
|---|---|
| `highlightAlbumParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/HighlightAlbumParams?` | The album highlight configuration, or `null` to clear. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_PICK_IMAGES_HIGHLIGHT_ALBUM` |   |

### setHighlightSearchResultsParams

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setHighlightSearchResultsParams(
    highlightSearchResultsParams: HighlightSearchResultsParams?
): PickVisualMediaRequest.Builder
```

Sets parameters for highlighting search results in the photo picker. This allows apps to highlight search results in the photopicker UI whenever feasible based on the given input text query. Only one of search results highlight or album highlight can be specified to either show a highlighted media section when the photopicker launches or to open the photopicker to show a highlighted media results grid based on the given input query. Specifying both album and search highlight will result in throwing `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html`.

This feature was added in Android Tiramisu (API level 33 / T ext 19) and will be ignored on Android R and S.

| Parameters |
|---|---|
| `highlightSearchResultsParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/HighlightSearchResultsParams?` | The search result highlight configuration, or `null` to clear. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_PICK_IMAGES_HIGHLIGHT_SEARCH_RESULTS` |   |

### setLocationMetadataAccessRequested

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setLocationMetadataAccessRequested(
    isLocationMetadataAccessRequested: Boolean
): PickVisualMediaRequest.Builder
```

Sets whether the caller requests access to location metadata for the selected media items.

When set to `true`, this informs the Photopicker that the app is requesting location information (such as EXIF GPS data) for the media items selected by the user. The default value is `false`, meaning location metadata is redacted by default.

Requesting location metadata does not guarantee that the calling app will receive it. The Photopicker may prompt the user via the picker UI, and the user's choice to allow or deny location sharing is final. If granted, calling apps can access this metadata when the selected media files are opened via the returned URIs.

This feature was added in SDK extension 23 on Android Tiramisu (API level 33) and higher. If the underlying Photopicker implementation or device does not support this feature, this request is safely ignored.

| Parameters |
|---|---|
| `isLocationMetadataAccessRequested: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | boolean whether to request location metadata access from the Photopicker |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

### setMaxItems

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setMaxItems(maxItems: @IntRange(from = 2) Int): PickVisualMediaRequest.Builder
```

Limit the number of selectable items in the photo picker when using `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickMultipleVisualMedia`

| Parameters |
|---|---|
| `maxItems: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | int type limiting the number of selectable items |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

### setMediaCapabilitiesForTranscoding

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
@RequiresApi(value = 33)
fun setMediaCapabilitiesForTranscoding(
    mediaCapabilities: PickVisualMedia.MediaCapabilities?
): PickVisualMediaRequest.Builder
```

Set the media capabilities for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`.

This parameter allows you to specify the media capabilities that your application can handle, such as the HDR type of the media. This parameter might be not supported by the underlying photo picker implementation.

When the requested video format does not match the capabilities specified by the calling app and the video duration is within the range that photo picker can handle, photo picker will transcode the video into a default supported format, otherwise, the calling app will receive the original file.

| Parameters |
|---|---|
| `mediaCapabilities: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.MediaCapabilities?` | the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.MediaCapabilities` to apply to the media selection. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

### setMediaType

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setMediaType(mediaType: PickVisualMedia.VisualMediaType): PickVisualMediaRequest.Builder
```

Set the media type for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`.

The type is the mime type to filter by, e.g. `PickVisualMedia.ImageOnly`, `PickVisualMedia.ImageAndVideo`, `PickVisualMedia.SingleMimeType("image/gif")`

| Parameters |
|---|---|
| `mediaType: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMedia.VisualMediaType` | type to go into the PickVisualMediaRequest |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

### setOrderedSelection

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setOrderedSelection(isOrderedSelection: Boolean): PickVisualMediaRequest.Builder
```

Set the ordered selection for the `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest`.

Allow the user to control the order in which images are returned to the calling app. This parameter might be not supported by the underlying photo picker implementation.

| Parameters |
|---|---|
| `isOrderedSelection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | boolean to enable customisable selection order in the picker |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

### setSelectionParams

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
@RequiresExtension(extension = 34, version = 22)
fun setSelectionParams(selectionParams: SelectionParams?): PickVisualMediaRequest.Builder
```

Sets selection constraints for media items in the photo picker. The items that do not satisfy these input constraints will not be selectable in the photopicker grid.

This feature was added for the system PhotoPicker in SDK extension version 22 (API level 34 / U ext 22) and is available starting from the same and higher. If the platform conditions are not met, this cannot be used. Callers of this must add this check before using.

| Parameters |
|---|---|
| `selectionParams: https://developer.android.com/reference/kotlin/androidx/photopicker/activity/params/SelectionParams?` | The selection constraint parameters, or `null` to clear. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/photopicker/activity/PickVisualMediaRequest.Builder` | This builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_PICK_IMAGES_SELECTION_PARAMS` |   |

### setUiCustomizationParams

Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/photopicker#1.0.0-alpha03)

```
fun setUiCustomizationParams(uiCustomizationParams: UiCustomizationParams?): PickVisualMediaRequest.Builder
```