# 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)

*** ** * ** ***


```
public final class PickVisualMediaRequest.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

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

## Public constructors

### Builder

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

```
public Builder()
```

## Public methods

### build

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

```
public final @NonNull PickVisualMediaRequest build()
```

Build the PickVisualMediaRequest specified by this builder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setAccentColor(long accentColor)
```

Set the accent color for the `https://developer.android.com/reference/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 |
|---|---|
| `long accentColor` | color long to apply as accent to the main color in the picker |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setDefaultTab(@NonNull PickVisualMedia.DefaultTab defaultTab)
```

Set the default tab for the `https://developer.android.com/reference/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/androidx/photopicker/activity/PickVisualMedia.DefaultTab.PhotosTab`, `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/photopicker/activity/PickVisualMedia.DefaultTab defaultTab` | the tab to launch the picker in (defaults to `https://developer.android.com/reference/androidx/photopicker/activity/PickVisualMedia.DefaultTab.PhotosTab`) |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setHighlightAlbumParams(HighlightAlbumParams highlightAlbumParams)
```

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/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 |
|---|---|
| `https://developer.android.com/reference/androidx/photopicker/activity/params/HighlightAlbumParams highlightAlbumParams` | The album highlight configuration, or `null` to clear. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setHighlightSearchResultsParams(
    HighlightSearchResultsParams highlightSearchResultsParams
)
```

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 |
|---|---|
| `https://developer.android.com/reference/androidx/photopicker/activity/params/HighlightSearchResultsParams highlightSearchResultsParams` | The search result highlight configuration, or `null` to clear. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setLocationMetadataAccessRequested(
    boolean isLocationMetadataAccessRequested
)
```

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 |
|---|---|
| `boolean isLocationMetadataAccessRequested` | boolean whether to request location metadata access from the Photopicker |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setMaxItems(@IntRange(from = 2) int maxItems)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 2) int maxItems` | int type limiting the number of selectable items |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)
public final @NonNull PickVisualMediaRequest.Builder setMediaCapabilitiesForTranscoding(
    PickVisualMedia.MediaCapabilities mediaCapabilities
)
```

Set the media capabilities for the `https://developer.android.com/reference/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 |
|---|---|
| `https://developer.android.com/reference/androidx/photopicker/activity/PickVisualMedia.MediaCapabilities mediaCapabilities` | the `https://developer.android.com/reference/androidx/photopicker/activity/PickVisualMedia.MediaCapabilities` to apply to the media selection. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setMediaType(@NonNull PickVisualMedia.VisualMediaType mediaType)
```

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

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

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

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setOrderedSelection(boolean isOrderedSelection)
```

Set the ordered selection for the `https://developer.android.com/reference/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 |
|---|---|
| `boolean isOrderedSelection` | boolean to enable customisable selection order in the picker |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)
public final @NonNull PickVisualMediaRequest.Builder setSelectionParams(SelectionParams selectionParams)
```

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 |
|---|---|
| `https://developer.android.com/reference/androidx/photopicker/activity/params/SelectionParams selectionParams` | The selection constraint parameters, or `null` to clear. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/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)

```
public final @NonNull PickVisualMediaRequest.Builder setUiCustomizationParams(UiCustomizationParams uiCustomizationParams)
```