Camera

public interface Camera

androidx.camera.core.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 CameraControl getCameraControl()

Returns the CameraControl for the Camera.

abstract CameraInfo getCameraInfo()

Returns information about this camera.

Public methods

getCameraControl

public abstract 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.

Returns
CameraControl

getCameraInfo

public abstract 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
CameraInfo the CameraInfo.