# Preview.Builder

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/Preview.java+class:androidx.camera.core.Preview.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

*** ** * ** ***


```
class Preview.Builder : ExtendableBuilder, UseCase.InteropConfigurable<Preview.Builder!>
```

<br />

*** ** * ** ***

Builder for a `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#Builder()()` Creates a new Builder object. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#build()()` Builds an immutable `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` from the current state. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setDynamicRange(androidx.camera.core.DynamicRange)(dynamicRange: https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange)` Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange`. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setMirrorMode(int)(mirrorMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the mirror mode. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setPreviewStabilizationEnabled(boolean)(enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Enable preview stabilization. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(resolutionSelector: https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector)` Sets the resolution selector to select the preferred supported resolution. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `[setTargetAspectRatio](https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetAspectRatio(int))(aspectRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` with `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/AspectRatioStrategy` to specify the preferred aspect ratio settings instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetFrameRate(android.util.Range<java.lang.Integer>)(targetFrameRate: https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>)` Sets the target frame rate range in frames per second for the associated Preview use case. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetName(java.lang.String)(targetName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Sets the name of the target object being configured, used only for debug logging. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `[setTargetResolution](https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size))(resolution: https://developer.android.com/reference/android/util/Size.html)` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` with `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionStrategy` to specify the preferred resolution settings instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetRotation(int)(rotation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the rotation that the intended target resolution is expressed in. |

### Inherited functions

From [androidx.camera.core.UseCase.InteropConfigurable](https://developer.android.com/reference/kotlin/androidx/camera/core/UseCase.InteropConfigurable) `B` `https://developer.android.com/reference/kotlin/androidx/camera/core/UseCase.InteropConfigurable#setInterop(androidx.camera.core.InteropConfigurator<? super B>)(configurator: https://developer.android.com/reference/kotlin/androidx/camera/core/InteropConfigurator<B!>)`

Applies interoperability configuration to this builder.

## Public constructors

### Builder

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

```
Builder()
```

Creates a new Builder object.

## Public functions

### build

```
fun build(): Preview
```

Builds an immutable `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` from the current state.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` | A `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` populated with the current state. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if attempting to set both target aspect ratio and target resolution. |

### setDynamicRange

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun setDynamicRange(dynamicRange: DynamicRange): Preview.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange`.

Dynamic range specifies how the range of colors, highlights and shadows captured by the frame producer are represented on a display. Some dynamic ranges allow the preview surface to make full use of the extended range of brightness of the display.

The supported dynamic ranges for preview depend on the capabilities of the camera and the ability of the `https://developer.android.com/reference/android/view/Surface.html` provided by the `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.SurfaceProvider` to consume the dynamic range. The supported dynamic ranges of the camera can be queried using `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo#querySupportedDynamicRanges(java.util.Set<androidx.camera.core.DynamicRange>)`.

As an example, having written an OpenGL frame processing pipeline that can properly handle input dynamic ranges `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#SDR()`, `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#HLG_10_BIT()` and `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#HDR10_10_BIT()`, it's possible to filter those dynamic ranges based on which dynamic ranges the camera can produce via the `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` use case:

```kotlin
       // Constant defining the dynamic ranges supported as input for
       // my OpenGL processing pipeline. These will either be outputted
       // in the same dynamic range as the input or will be tone-mapped
       // to another dynamic range by my pipeline.
       List<DynamicRange> MY_SUPPORTED_DYNAMIC_RANGES = Set.of(
               DynamicRange.SDR,
               DynamicRange.HLG_10_BIT,
               DynamicRange.HDR10_10_BIT);
       ...

       // Query dynamic ranges supported by the camera from the
       // dynamic ranges supported by my processing pipeline.
       mSupportedHighDynamicRanges =
               mCameraInfo.querySupportedDynamicRanges(
                       mySupportedDynamicRanges);

       // Update our UI picker for dynamic range.
       ...


       // Create the Preview use case from the dynamic range
       // selected by the UI picker.
       mPreview = new Preview.Builder()
               .setDynamicRange(mSelectedDynamicRange)
               .build();
  
```

If the dynamic range is not provided, the returned `Preview` use case will use a default of `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#UNSPECIFIED()`. When a `Preview` is bound with other use cases that specify a dynamic range, such as `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture`, and the preview dynamic range is `
UNSPECIFIED`, the resulting dynamic range of the preview will usually match the other use case's dynamic range. If no other use cases are bound with the preview, an `UNSPECIFIED` dynamic range will resolve to `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#SDR()`. When using a `Preview` with another use case, it is recommended to leave the dynamic range of the `Preview` as `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#UNSPECIFIED()`, so the camera can choose the best supported dynamic range that satisfies the requirements of both use cases.

If an unspecified dynamic range is used, the resolved fully-defined dynamic range of frames sent from the camera will be communicated to the `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.SurfaceProvider` via `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#getDynamicRange()`, and the provided `https://developer.android.com/reference/android/view/Surface.html` should be configured to use that dynamic range.

It is possible to choose a high dynamic range (HDR) with unspecified encoding by providing `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange#HDR_UNSPECIFIED_10_BIT()`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/DynamicRange` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo#querySupportedDynamicRanges(java.util.Set<androidx.camera.core.DynamicRange>)` |   |

### setMirrorMode

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun setMirrorMode(mirrorMode: Int): Preview.Builder
```

Sets the mirror mode.

Valid values include: `https://developer.android.com/reference/kotlin/androidx/camera/core/MirrorMode#MIRROR_MODE_OFF()`, `https://developer.android.com/reference/kotlin/androidx/camera/core/MirrorMode#MIRROR_MODE_ON()` and `https://developer.android.com/reference/kotlin/androidx/camera/core/MirrorMode#MIRROR_MODE_ON_FRONT_ONLY()`. If not set, it defaults to `https://developer.android.com/reference/kotlin/androidx/camera/core/MirrorMode#MIRROR_MODE_ON_FRONT_ONLY()`.

For API 33 and above, it will change the mirroring behavior for Preview use case. It is calling `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#setMirrorMode(int)`.

For API 32 and below, it will be no-op.

| Parameters |
|---|---|
| `mirrorMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The mirror mode of the intended target. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/params/OutputConfiguration.html#setMirrorMode(int)` |   |

### setPreviewStabilizationEnabled

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun setPreviewStabilizationEnabled(enabled: Boolean): Preview.Builder
```

Enable preview stabilization. It will enable stabilization for both the preview and video capture use cases.

Devices running Android 13 or higher can provide support for video stabilization. This feature lets apps provide a what you see is what you get (WYSIWYG) experience when comparing between the camera preview and the recording.

It is recommended to query the device capability via `https://developer.android.com/reference/kotlin/androidx/camera/core/PreviewCapabilities#isStabilizationSupported()` before enabling this feature, otherwise HAL error might be thrown.

If both preview stabilization and video stabilization are enabled or disabled, the final result will be

| Preview | VideoCapture | Result |
|---|---|---|
| ON | ON | Both Preview and VideoCapture will be stabilized, VideoCapture quality might be worse than only VideoCapture stabilized |
| ON | OFF | None of Preview and VideoCapture will be stabilized |
| ON | NOT SPECIFIED | Both Preview and VideoCapture will be stabilized |
| OFF | ON | None of Preview and VideoCapture will be stabilized |
| OFF | OFF | None of Preview and VideoCapture will be stabilized |
| OFF | NOT SPECIFIED | None of Preview and VideoCapture will be stabilized |
| NOT SPECIFIED | ON | Only VideoCapture will be stabilized, Preview might be stabilized depending on devices |
| NOT SPECIFIED | OFF | None of Preview and VideoCapture will be stabilized |

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if enable, otherwise false. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | the current Builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/PreviewCapabilities#isStabilizationSupported()` |   |

### setResolutionSelector

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun setResolutionSelector(resolutionSelector: ResolutionSelector): Preview.Builder
```

Sets the resolution selector to select the preferred supported resolution.

When using the `camera-camera2` CameraX implementation, the selected resolution will be limited by the `PREVIEW` size which is defined as the best size match to the device's screen resolution, or to 1080p (1920x1080), whichever is smaller. See the [Regular capture](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#regular-capture) section in `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html`'. Applications can set any `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionStrategy` to override it.

Note that due to compatibility reasons, CameraX may select a resolution that is larger than the default screen resolution on certain devices.

The existing `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size)` and `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetAspectRatio(int)` APIs are deprecated and are not compatible with `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)`. Calling either of these APIs together with `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` will result in an `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` being thrown when you attempt to build the `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` instance.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

### setTargetAspectRatio

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun [setTargetAspectRatio](https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetAspectRatio(int))(aspectRatio: Int): Preview.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` with `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/AspectRatioStrategy` to specify the preferred aspect ratio settings instead.

Sets the aspect ratio of the intended target for images from this configuration.

The aspect ratio is the ratio of width to height in the sensor orientation.

It is not allowed to set both target aspect ratio and target resolution on the same use case. Attempting so will throw an IllegalArgumentException when building the Config.

The target aspect ratio is used as a hint when determining the resulting output aspect ratio which may differ from the request, possibly due to device constraints. Application code should check the resulting output's resolution and the resulting aspect ratio may not be exactly as requested.

For Preview, the value will be used to calculate the suggested resolution size in `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#getResolution()`.

If not set, or `https://developer.android.com/reference/kotlin/androidx/camera/core/AspectRatio#RATIO_DEFAULT()` is supplied, resolutions with aspect ratio 4:3 will be considered in higher priority.

For the following devices, the aspect ratio will be forced to `https://developer.android.com/reference/kotlin/androidx/camera/core/AspectRatio#RATIO_16_9()` regardless of the config. On these devices, the camera HAL produces a preview with a 16:9 aspect ratio regardless of the aspect ratio of the preview surface.

- SM-J710MN, Samsung Galaxy J7 (2016)
- SM-T580, Samsung Galaxy Tab A J7 (2016)

| Parameters |
|---|---|
| `aspectRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The desired Preview `https://developer.android.com/reference/kotlin/androidx/camera/core/AspectRatio` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

### setTargetFrameRate

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun setTargetFrameRate(targetFrameRate: Range<Int!>): Preview.Builder
```

Sets the target frame rate range in frames per second for the associated Preview use case.

Device will try to get as close as possible to the target frame rate. This may affect the selected resolutions of the surfaces, resulting in better frame rates at the potential reduction of resolution.

Achieving target frame rate is dependent on device capabilities, as well as other concurrently attached use cases and their target frame rates. Because of this, the frame rate that is ultimately selected is not guaranteed to be a perfect match to the requested target.

| Parameters |
|---|---|
| `targetFrameRate: https://developer.android.com/reference/android/util/Range.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | a desired frame rate range. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | the current Builder. |

### setTargetName

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

```
fun setTargetName(targetName: String): Preview.Builder
```

Sets the name of the target object being configured, used only for debug logging.

The name should be a value that can uniquely identify an instance of the object being configured.

If not set, the target name will default to an unique name automatically generated with the class canonical name and random UUID.

| Parameters |
|---|---|
| `targetName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A unique string identifier for the instance of the class being configured. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | the current Builder. |

### setTargetResolution

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0) Deprecated in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun [setTargetResolution](https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size))(resolution: Size): Preview.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionSelector` with `https://developer.android.com/reference/kotlin/androidx/camera/core/resolutionselector/ResolutionStrategy` to specify the preferred resolution settings instead.

Sets the resolution of the intended target from this configuration.

The target resolution attempts to establish a minimum bound for the preview resolution. The actual preview resolution will be the closest available resolution in size that is not smaller than the target resolution, as determined by the Camera implementation. However, if no resolution exists that is equal to or larger than the target resolution, the nearest available resolution smaller than the target resolution will be chosen. Resolutions with the same aspect ratio of the provided `https://developer.android.com/reference/android/util/Size.html` will be considered in higher priority before resolutions of different aspect ratios.

It is not allowed to set both target aspect ratio and target resolution on the same use case. Attempting so will throw an IllegalArgumentException when building the Config.

The resolution `https://developer.android.com/reference/android/util/Size.html` should be expressed in the coordinate frame after rotating the supported sizes by the target rotation. For example, a device with portrait natural orientation in natural target rotation requesting a portrait image may specify 480x640, and the same device, rotated 90 degrees and targeting landscape orientation may specify 640x480.

The maximum available resolution that could be selected for a `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` is limited to be under 1080p. The limitation of 1080p for `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview` has considered both performance and quality factors that users can obtain reasonable quality and smooth output stream under 1080p.

If not set, the default selected resolution will be the best size match to the device's screen resolution, or to 1080p (1920x1080), whichever is smaller. Note that due to compatibility reasons, CameraX may select a resolution that is larger than the default screen resolution on certain devices.

When using the `camera-camera2` CameraX implementation, which resolution will be finally selected will depend on the camera device's hardware level and the bound use cases combination. For more details see the guaranteed supported configurations tables in `https://developer.android.com/reference/android/hardware/camera2/CameraDevice.html`'s [Regular capture](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#regular-capture) section.

| Parameters |
|---|---|
| `resolution: https://developer.android.com/reference/android/util/Size.html` | The target resolution to choose from supported output sizes list. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

### setTargetRotation

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

```
fun setTargetRotation(rotation: Int): Preview.Builder
```

Sets the rotation that the intended target resolution is expressed in.

This sets the rotation that is used when specifying a target resolution using `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size)`, which accepts a resolution at the target orientation.

rotation is one of four valid values: `https://developer.android.com/reference/android/view/Surface.html#ROTATION_0`, `https://developer.android.com/reference/android/view/Surface.html#ROTATION_90`, `https://developer.android.com/reference/android/view/Surface.html#ROTATION_180`, `https://developer.android.com/reference/android/view/Surface.html#ROTATION_270`. Rotation values are relative to the "natural" rotation, `https://developer.android.com/reference/android/view/Surface.html#ROTATION_0`.

For example a portrait natural device may specify a portrait image target resolution as 480x640, and the same device rotated to and displaying in landscape (i.e. as returned by `https://developer.android.com/reference/android/view/Display.html#getRotation()`) may set the target rotation to `https://developer.android.com/reference/android/view/Surface.html#ROTATION_90` and resolution to 640x480.

If not set, the target rotation will default to the value of `https://developer.android.com/reference/android/view/Display.html#getRotation()` of the default display at the time the use case is created. The use case is fully created once it has been attached to a camera.

Note that `https://developer.android.com/reference/android/view/SurfaceView.html` does not support non-display rotation. If the target rotation is different than the value of `https://developer.android.com/reference/android/view/Display.html#getRotation()`, `https://developer.android.com/reference/android/view/SurfaceView.html` should not be used to provide the `https://developer.android.com/reference/android/view/Surface.html` in `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)`

| Parameters |
|---|---|
| `rotation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The rotation of the intended target. Value is one of the following: - `Surface.ROTATION_0` - `Surface.ROTATION_90` - `Surface.ROTATION_180` - `Surface.ROTATION_270` <br /> |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder` | The current Builder. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size)` |   |