Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder "View this page in Java")

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.hardware.camera2.params.DeviceStateSensorOrientationMap.Builder](https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#) |

Builds a DeviceStateSensorOrientationMap object.

This builder is public to allow for easier application testing by creating custom object instances. It's not necessary to construct these objects during normal use of the camera API.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#Builder()()` <br /> |

| Public methods ||
|---|---|
| [DeviceStateSensorOrientationMap.Builder](https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#) | `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#addOrientationForState(kotlin.Long,%20kotlin.Long)(deviceState: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, angle: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Add a sensor orientation for a given device state. |
| [DeviceStateSensorOrientationMap](https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap) | `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#build()()` Returns an instance of `DeviceStateSensorOrientationMap` created from the fields set on this builder. |

## Public constructors

### Builder

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder()
```

## Public methods

### addOrientationForState

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun addOrientationForState(
    deviceState: Long, 
    angle: Long
): DeviceStateSensorOrientationMap.Builder
```

Add a sensor orientation for a given device state.

Each pair of deviceState and angle describes the camera sensor orientation when the device is in the matching deviceState. The angle is in degrees, and must be a multiple of 90.

| Parameters ||
|---|---|
| `deviceState` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The deviceState. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap#NORMAL:kotlin.Long` - `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap#FOLDED:kotlin.Long` |
| `angle` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The orientation angle in degrees. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder#` | This builder. This value cannot be `null`. |

### build

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): DeviceStateSensorOrientationMap
```

Returns an instance of `DeviceStateSensorOrientationMap` created from the fields set on this builder.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap` | A DeviceStateSensorOrientationMap. This value cannot be `null`. |