Builder

class Builder : Builder<CameraX!, CameraXConfig.Builder!>
kotlin.Any
   ↳ androidx.camera.core.CameraXConfig.Builder

A builder for generating CameraXConfig objects.

Summary

Public methods
CameraXConfig

Builds an immutable CameraXConfig from the current state.

static CameraXConfig.Builder
fromConfig(@NonNull configuration: CameraXConfig)

Generates a Builder from another CameraXConfig object

CameraXConfig.Builder
setCameraExecutor(@NonNull executor: Executor)

Sets an executor which CameraX will use to drive the camera stack.

CameraXConfig.Builder
setSchedulerHandler(@NonNull handler: Handler)

Sets a handler that CameraX will use internally for scheduling future tasks.

Public methods

build

@NonNull fun build(): CameraXConfig

Builds an immutable CameraXConfig from the current state.

Return
CameraXConfig A CameraXConfig populated with the current state.

fromConfig

@NonNull static fun fromConfig(@NonNull configuration: CameraXConfig): CameraXConfig.Builder

Generates a Builder from another CameraXConfig object

Parameters
configuration CameraXConfig: An immutable configuration to pre-populate this builder.
Return
CameraXConfig.Builder The new Builder.

setCameraExecutor

@NonNull fun setCameraExecutor(@NonNull executor: Executor): CameraXConfig.Builder

Sets an executor which CameraX will use to drive the camera stack.

This option can be used to override the default internal executor created by CameraX, and will be used by the implementation to drive all cameras.

It is not necessary to set an executor for normal use, and should only be used in applications with very specific threading requirements. If not set, CameraX will create and use an optimized default internal executor.

setSchedulerHandler

@NonNull fun setSchedulerHandler(@NonNull handler: Handler): CameraXConfig.Builder

Sets a handler that CameraX will use internally for scheduling future tasks.

This scheduler may also be used for legacy APIs which require a Handler. Tasks that are scheduled with this handler will always be executed by the camera executor. No business logic will be executed directly by this handler.

It is not necessary to set a scheduler handler for normal use, and should only be used in applications with very specific threading requirements. If not set, CameraX will create and use an optimized default internal handler.