CameraAccessException  |  API reference  |  Android Developers (original) (raw)


open class CameraAccessException : AndroidException

kotlin.Any
kotlin.Throwable
java.lang.Exception
android.util.AndroidException

CameraAccessException is thrown if a camera device could not be queried or opened by the [CameraManager](/reference/kotlin/android/hardware/camera2/CameraManager), or if the connection to an opened [CameraDevice](/reference/kotlin/android/hardware/camera2/CameraDevice) is no longer valid.

Summary

Constants
static Int CAMERA_DISABLED The camera is disabled due to a device policy, and cannot be opened.
static Int CAMERA_DISCONNECTED The camera device is removable and has been disconnected from the Android device, or the camera id used with android.
static Int CAMERA_ERROR The camera device is currently in the error state.
static Int CAMERA_IN_USE The camera device is in use already.
static Int MAX_CAMERAS_IN_USE The system-wide limit for number of open cameras or camera resources has been reached, and more camera devices cannot be opened or torch mode cannot be turned on until previous instances are closed.
Public constructors
CameraAccessException(problem: Int)
CameraAccessException(problem: Int, message: String!)
CameraAccessException(problem: Int, message: String!, cause: Throwable!)
CameraAccessException(problem: Int, cause: Throwable!)
Public methods
Int getReason() The reason for the failure to access the camera.

Constants

CAMERA_DISCONNECTED

static val CAMERA_DISCONNECTED: Int

The camera device is removable and has been disconnected from the Android device, or the camera id used with android.hardware.camera2.CameraManager#openCamera is no longer valid, or the camera service has shut down the connection due to a higher-priority access request for the camera device.

Value: 2

CAMERA_ERROR

static val CAMERA_ERROR: Int

The camera device is currently in the error state.

The camera has failed to open or has failed at a later time as a result of some non-user interaction. Refer to [CameraDevice.StateCallback.onError](/reference/kotlin/android/hardware/camera2/CameraDevice.StateCallback#onError%28android.hardware.camera2.CameraDevice,%20kotlin.Int%29) for the exact nature of the error.

No further calls to the camera will succeed. Clean up the camera with [CameraDevice.close](/reference/kotlin/android/hardware/camera2/CameraDevice#close%28%29) and try handling the error in order to successfully re-open the camera.

Value: 3

CAMERA_IN_USE

static val CAMERA_IN_USE: Int

The camera device is in use already.

Value: 4

MAX_CAMERAS_IN_USE

static val MAX_CAMERAS_IN_USE: Int

The system-wide limit for number of open cameras or camera resources has been reached, and more camera devices cannot be opened or torch mode cannot be turned on until previous instances are closed.

Value: 5

Public constructors

Public methods