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

Extender

class Extender
kotlin.Any
   ↳ androidx.camera.camera2.Camera2Config.Extender

Extends a Config.ExtendableBuilder to add Camera2 options.

Summary

Public constructors

<init>(@NonNull baseBuilder: Config.ExtendableBuilder)

Creates an Extender that can be used to add Camera2 options to another Builder.

Public methods

Camera2Config.Extender
setCaptureRequestOption(@NonNull key: Key<ValueT>, @NonNull value: ValueT)

Sets a CaptureRequest.Key and Value on the configuration.

Camera2Config.Extender
setDeviceStateCallback(@NonNull stateCallback: StateCallback)

Sets a CameraDevice.StateCallback.

Camera2Config.Extender
setSessionCaptureCallback(@NonNull captureCallback: CaptureCallback)

Sets a CameraCaptureSession.CaptureCallback.

Camera2Config.Extender
setSessionStateCallback(@NonNull stateCallback: StateCallback)

Sets a CameraCaptureSession.StateCallback.

Public constructors

<init>

Extender(@NonNull baseBuilder: Config.ExtendableBuilder)

Creates an Extender that can be used to add Camera2 options to another Builder.

Parameters
baseBuilder Config.ExtendableBuilder: The builder being extended.

Public methods

setCaptureRequestOption

@NonNull fun <ValueT : Any!> setCaptureRequestOption(@NonNull key: Key<ValueT>, @NonNull value: ValueT): Camera2Config.Extender

Sets a CaptureRequest.Key and Value on the configuration.

Parameters
key Key<ValueT>: The CaptureRequest.Key which will be set.
value Key<ValueT>: The value for the key.
<ValueT> Key<ValueT>: The type of the value.
Return
Camera2Config.Extender: The current Extender.

setDeviceStateCallback

@NonNull fun setDeviceStateCallback(@NonNull stateCallback: StateCallback): Camera2Config.Extender

Sets a CameraDevice.StateCallback.

The caller is expected to use the CameraDevice instance accessed through the callback methods responsibly. Generally safe usages include: (1) querying the device for its id, (2) using the callbacks to determine what state the device is currently in. Generally unsafe usages include: (1) creating a new CameraCaptureSession, (2) creating a new CaptureRequest, (3) closing the device. When the caller uses the device beyond the safe usage limits, the usage may still work in conjunction with CameraX, but any strong guarantees provided by CameraX about the validity of the camera state become void.

Parameters
stateCallback StateCallback: The CameraDevice.StateCallback.
Return
Camera2Config.Extender: The current Extender.

setSessionCaptureCallback

@NonNull fun setSessionCaptureCallback(@NonNull captureCallback: CaptureCallback): Camera2Config.Extender

Sets a CameraCaptureSession.CaptureCallback.

The caller is expected to use the CameraCaptureSession instance accessed through the callback methods responsibly. Generally safe usages include: (1) querying the session for its properties. Generally unsafe usages include: (1) submitting a new , (2) stopping an existing CaptureRequest, (3) closing the session, (4) attaching a new Surface to the session. When the caller uses the session beyond the safe usage limits, the usage may still work in conjunction with CameraX, but any strong gurantees provided by CameraX about the validity of the camera state become void.

The caller is generally free to use the CaptureRequest and instances accessed through the callback methods.

Parameters
captureCallback CaptureCallback: The CameraCaptureSession.CaptureCallback.
Return
Camera2Config.Extender: The current Extender.

setSessionStateCallback

@NonNull fun setSessionStateCallback(@NonNull stateCallback: StateCallback): Camera2Config.Extender

Sets a CameraCaptureSession.StateCallback.

The caller is expected to use the CameraCaptureSession instance accessed through the callback methods responsibly. Generally safe usages include: (1) querying the session for its properties, (2) using the callbacks to determine what state the session is currently in. Generally unsafe usages include: (1) submitting a new , (2) stopping an existing CaptureRequest, (3) closing the session, (4) attaching a new Surface to the session. When the caller uses the session beyond the safe usage limits, the usage may still work in conjunction with CameraX, but any strong gurantees provided by CameraX about the validity of the camera state become void.

Parameters
stateCallback StateCallback: The CameraCaptureSession.StateCallback.
Return
Camera2Config.Extender: The current Extender.