Stay organized with collections
Save and categorize content based on your preferences.
Builder
class 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
Public methods
addOrientationForState
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# DeviceStateSensorOrientationMap.Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/camera2/params/DeviceStateSensorOrientationMap.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|------------------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.camera2.params.DeviceStateSensorOrientationMap.Builder](#) |\n\nBuilds a DeviceStateSensorOrientationMap object.\n\nThis 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.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [DeviceStateSensorOrientationMap.Builder](#) | [addOrientationForState](#addOrientationForState(kotlin.Long,%20kotlin.Long))`(`deviceState:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `angle:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Add a sensor orientation for a given device state. |\n| [DeviceStateSensorOrientationMap](/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap) | [build](#build())`()` Returns an instance of `DeviceStateSensorOrientationMap` created from the fields set on this builder. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addOrientationForState\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addOrientationForState(\n deviceState: Long, \n angle: Long\n): DeviceStateSensorOrientationMap.Builder\n```\n\nAdd a sensor orientation for a given device state.\n\nEach 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.\n\n| Parameters ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `deviceState` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The deviceState. Value is [android.hardware.camera2.params.DeviceStateSensorOrientationMap#NORMAL](/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap#NORMAL:kotlin.Long), or [android.hardware.camera2.params.DeviceStateSensorOrientationMap#FOLDED](/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap#FOLDED:kotlin.Long) |\n| `angle` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The orientation angle in degrees. |\n\n| Return ||\n|----------------------------------------------|--------------------------------------------|\n| [DeviceStateSensorOrientationMap.Builder](#) | This builder. This value cannot be `null`. |\n\n### build\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): DeviceStateSensorOrientationMap\n```\n\nReturns an instance of `DeviceStateSensorOrientationMap` created from the fields set on this builder.\n\n| Return ||\n|----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| [DeviceStateSensorOrientationMap](/reference/kotlin/android/hardware/camera2/params/DeviceStateSensorOrientationMap) | A DeviceStateSensorOrientationMap. This value cannot be `null`. |"]]