Camera


public interface Camera


The camera interface is used to control the flow of data to use cases, control the camera via the CameraControl, and publish the state of the camera via CameraInfo.

An example of how to obtain an instance of this class can be found in the androidx.camera.lifecycle package.

Summary

Public methods

abstract @NonNull CameraControl

Returns the CameraControl for the Camera.

abstract @NonNull CameraInfo

Returns information about this camera.

Public methods

getCameraControl

Added in 1.0.0
abstract @NonNull CameraControl getCameraControl()

Returns the CameraControl for the Camera.

The CameraControl provides various asynchronous operations like zoom, focus and metering. CameraControl is ready to start operations immediately after use cases are bound to the Camera. When all UseCases are unbound, or when camera is closing or closed because lifecycle onStop happens, the CameraControl will reject all operations.

Each method of CameraControl returns a ListenableFuture which apps can use to check the asynchronous result. If the operation is not allowed in current state, the returned ListenableFuture will fail immediately with CameraControl.OperationCanceledException.

getCameraInfo

Added in 1.0.0
abstract @NonNull CameraInfo getCameraInfo()

Returns information about this camera.

The returned information can be used to query static camera characteristics or observe the runtime state of the camera.

Returns
@NonNull CameraInfo

the CameraInfo.