public final class

CameraSelector.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.CameraSelector.Builder

Overview

Builder for a CameraSelector.

Summary

Constructors
publicBuilder()

Methods
public CameraSelector.BuilderaddCameraFilter(CameraFilter cameraFilter)

Adds a CameraFilter to the current set of filters.

public CameraSelectorbuild()

Builds the CameraSelector.

public static CameraSelector.BuilderfromSelector(CameraSelector cameraSelector)

Generates a Builder from another CameraSelector object.

public CameraSelector.BuilderrequireLensFacing(int lensFacing)

Requires a camera with the specified lens facing.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Methods

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.

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.

public static CameraSelector.Builder fromSelector(CameraSelector cameraSelector)

Generates a Builder from another CameraSelector object.

Parameters:

cameraSelector: An existing CameraSelector.

Returns:

The new Builder.

public CameraSelector build()

Builds the CameraSelector.