Google is committed to advancing racial equity for Black communities. See how.

CameraSelector.Builder

public static final class CameraSelector.Builder
extends Object

java.lang.Object
   ↳ androidx.camera.core.CameraSelector.Builder


Builder for a CameraSelector.

Summary

Public constructors

Builder()

Public methods

CameraSelector.Builder addCameraFilter(CameraFilter cameraFilter)

Adds a CameraFilter to the current set of filters.

CameraSelector build()

Builds the CameraSelector.

CameraSelector.Builder requireLensFacing(int lensFacing)

Requires a camera with the specified lens facing.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addCameraFilter

public CameraSelector.Builder addCameraFilter (CameraFilter cameraFilter)

Adds a CameraFilter to the current set of filters. It can be used to select a specific camera based on customized criteria like Camera2 characteristics.

Multiple filters can be added. All filters will be applied by the order they were added when the CameraSelector is used, and the first camera output from the filters will be selected.

Parameters
cameraFilter CameraFilter

Returns
CameraSelector.Builder

build

public CameraSelector build ()

Builds the CameraSelector.

Returns
CameraSelector

requireLensFacing

public CameraSelector.Builder requireLensFacing (int lensFacing)

Requires a camera with the specified lens facing.

Valid values for lens facing are CameraSelector.LENS_FACING_FRONT and CameraSelector.LENS_FACING_BACK.

If lens facing is already set, this will add extra requirement for lens facing instead of replacing the previous setting.

Parameters
lensFacing int

Returns
CameraSelector.Builder