Builder

class Builder
kotlin.Any
   ↳ androidx.camera.core.CameraSelector.Builder

Builder for a CameraSelector.

Summary

Public constructors

Public methods
CameraSelector.Builder
addCameraFilter(@NonNull cameraFilter: CameraFilter)

Adds a CameraFilter to the current set of filters.

CameraSelector

Builds the CameraSelector.

CameraSelector.Builder
requireLensFacing(lensFacing: Int)

Requires a camera with the specified lens facing.

Public constructors

<init>

Builder()

Public methods

addCameraFilter

@NonNull fun addCameraFilter(@NonNull cameraFilter: CameraFilter): CameraSelector.Builder

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.

build

@NonNull fun build(): CameraSelector

Builds the CameraSelector.

requireLensFacing

@NonNull fun requireLensFacing(lensFacing: Int): CameraSelector.Builder

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.