Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Camera2Config

class Camera2Config : Config
kotlin.Any
   ↳ androidx.camera.camera2.Camera2Config

Configuration options related to the android.hardware.camera2 APIs.

Summary

Nested classes

Extends a Config.ExtendableBuilder to add Camera2 options.

Public constructors

<init>(@NonNull config: Config)

Creates a Camera2Config for reading Camera2 options from the given config.

Public methods

ValueT?
getCaptureRequestOption(@NonNull key: Key<ValueT>, @Nullable valueIfMissing: ValueT?)

Returns a value for the given CaptureRequest.Key.

StateCallback?
getDeviceStateCallback(@Nullable valueIfMissing: StateCallback?)

Returns the stored CameraDevice.StateCallback.

CaptureCallback?
getSessionCaptureCallback(@Nullable valueIfMissing: CaptureCallback?)

Returns the stored CameraCaptureSession.CaptureCallback.

StateCallback?
getSessionStateCallback(@Nullable valueIfMissing: StateCallback?)

Returns the stored CameraCaptureSession.StateCallback.

Public constructors

<init>

Camera2Config(@NonNull config: Config)

Creates a Camera2Config for reading Camera2 options from the given config.

Parameters
config Config: The config that potentially contains Camera2 options.

Public methods

getCaptureRequestOption

@Nullable fun <ValueT : Any!> getCaptureRequestOption(@NonNull key: Key<ValueT>, @Nullable valueIfMissing: ValueT?): ValueT?

Returns a value for the given CaptureRequest.Key.

Parameters
key Key<ValueT>: The key to retrieve.
valueIfMissing Key<ValueT>: The value to return if this configuration option has not been set.
<ValueT> Key<ValueT>: The type of the value.
Return
ValueT?: The stored value or valueIfMissing if the value does not exist in this configuration.

getDeviceStateCallback

@Nullable fun getDeviceStateCallback(@Nullable valueIfMissing: StateCallback?): StateCallback?

Returns the stored CameraDevice.StateCallback.

Parameters
valueIfMissing StateCallback?: The value to return if this configuration option has not been set.
Return
StateCallback?: The stored value or valueIfMissing if the value does not exist in this configuration.

getSessionCaptureCallback

@Nullable fun getSessionCaptureCallback(@Nullable valueIfMissing: CaptureCallback?): CaptureCallback?

Returns the stored CameraCaptureSession.CaptureCallback.

Parameters
valueIfMissing CaptureCallback?: The value to return if this configuration option has not been set.
Return
CaptureCallback?: The stored value or valueIfMissing if the value does not exist in this configuration.

getSessionStateCallback

@Nullable fun getSessionStateCallback(@Nullable valueIfMissing: StateCallback?): StateCallback?

Returns the stored CameraCaptureSession.StateCallback.

Parameters
valueIfMissing StateCallback?: The value to return if this configuration option has not been set.
Return
StateCallback?: The stored value or valueIfMissing if the value does not exist in this configuration.