The second Android 11 Developer Preview is now available, test it out and share your feedback.

Extender

class Extender<T : Any!>
kotlin.Any
   ↳ androidx.camera.camera2.interop.Camera2Interop.Extender

Extends a ExtendableBuilder to add Camera2 options.

Summary

Public constructors

<init>(@NonNull baseBuilder: ExtendableBuilder<T>)

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

Public methods

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

Sets a CaptureRequest.Key and Value on the configuration.

Camera2Interop.Extender<T>
setDeviceStateCallback(@NonNull stateCallback: StateCallback)

Sets a CameraDevice.StateCallback.

Camera2Interop.Extender<T>
setSessionCaptureCallback(@NonNull captureCallback: CaptureCallback)

Sets a CameraCaptureSession.CaptureCallback.

Camera2Interop.Extender<T>
setSessionStateCallback(@NonNull stateCallback: StateCallback)

Sets a CameraCaptureSession.StateCallback.

Public constructors

<init>

Extender(@NonNull baseBuilder: ExtendableBuilder<T>)

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

Parameters
baseBuilder ExtendableBuilder<T>: The builder being extended.

Public methods

setCaptureRequestOption

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

Sets a CaptureRequest.Key and Value on the configuration.

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

setDeviceStateCallback

@NonNull fun setDeviceStateCallback(@NonNull stateCallback: StateCallback): Camera2Interop.Extender<T>

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
Camera2Interop.Extender<T> The current Extender.

setSessionCaptureCallback

@NonNull fun setSessionCaptureCallback(@NonNull captureCallback: CaptureCallback): Camera2Interop.Extender<T>

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 android.view.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 guarantees 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
Camera2Interop.Extender<T> The current Extender.

setSessionStateCallback

@NonNull fun setSessionStateCallback(@NonNull stateCallback: StateCallback): Camera2Interop.Extender<T>

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 android.view.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 guarantees provided by CameraX about the validity of the camera state become void.

Parameters
stateCallback StateCallback: The CameraCaptureSession.StateCallback.
Return
Camera2Interop.Extender<T> The current Extender.