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

Camera2Config.Extender

public static final class Camera2Config.Extender
extends Object

java.lang.Object
   ↳ androidx.camera.camera2.Camera2Config.Extender


Extends a Config.ExtendableBuilder to add Camera2 options.

Summary

Public constructors

Camera2Config.Extender(Config.ExtendableBuilder baseBuilder)

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

Public methods

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

Sets a CaptureRequest.Key and Value on the configuration.

Camera2Config.Extender setDeviceStateCallback(CameraDevice.StateCallback stateCallback)

Sets a CameraDevice.StateCallback.

Camera2Config.Extender setSessionCaptureCallback(CameraCaptureSession.CaptureCallback captureCallback)

Sets a CameraCaptureSession.CaptureCallback.

Camera2Config.Extender setSessionStateCallback(CameraCaptureSession.StateCallback stateCallback)

Sets a CameraCaptureSession.StateCallback.

Inherited methods

Public constructors

Camera2Config.Extender

public Camera2Config.Extender (Config.ExtendableBuilder baseBuilder)

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

public Camera2Config.Extender setCaptureRequestOption (Key<ValueT> key, 
                ValueT value)

Sets a CaptureRequest.Key and Value on the configuration.

Parameters
key Key: The CaptureRequest.Key which will be set.

value ValueT: The value for the key.

Returns
Camera2Config.Extender The current Extender.

setDeviceStateCallback

public Camera2Config.Extender setDeviceStateCallback (CameraDevice.StateCallback stateCallback)

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 CameraDevice.StateCallback: The CameraDevice.StateCallback.

Returns
Camera2Config.Extender The current Extender.

setSessionCaptureCallback

public Camera2Config.Extender setSessionCaptureCallback (CameraCaptureSession.CaptureCallback captureCallback)

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 CaptureRequest, (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 CaptureResult instances accessed through the callback methods.

Parameters
captureCallback CameraCaptureSession.CaptureCallback: The CameraCaptureSession.CaptureCallback.

Returns
Camera2Config.Extender The current Extender.

setSessionStateCallback

public Camera2Config.Extender setSessionStateCallback (CameraCaptureSession.StateCallback stateCallback)

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 CaptureRequest, (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 CameraCaptureSession.StateCallback: The CameraCaptureSession.StateCallback.

Returns
Camera2Config.Extender The current Extender.