Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Builder

open class Builder
kotlin.Any
   ↳ androidx.camera.core.FocusMeteringAction.Builder

The builder used to create the FocusMeteringAction. App must use Builder#from(MeteringPoint) or Builder#from(MeteringPoint, MeteringMode) to create the Builder.

Summary

Public methods

open FocusMeteringAction.Builder
addPoint(@NonNull point: MeteringPoint)

Adds another MeteringPoint with default MeteringMode.

open FocusMeteringAction.Builder
addPoint(@NonNull point: MeteringPoint, @NonNull mode: FocusMeteringAction.MeteringMode)

Adds another MeteringPoint with specified MeteringMode.

open FocusMeteringAction

Builds the FocusMeteringAction instance.

open FocusMeteringAction.Builder

Disables the auto-cancel.

open static FocusMeteringAction.Builder
from(@NonNull meteringPoint: MeteringPoint)

Creates the Builder from a MeteringPoint with default MeteringMode.

open static FocusMeteringAction.Builder
from(@NonNull meteringPoint: MeteringPoint, @NonNull mode: FocusMeteringAction.MeteringMode)

Creates the Builder from a MeteringPoint and MeteringMode

open FocusMeteringAction.Builder
setAutoCancelDuration(duration: Long, @NonNull timeUnit: TimeUnit)

Sets the auto-cancel duration.

open FocusMeteringAction.Builder

Sets the OnAutoFocusListener to be notified when auto-focus completes.

open FocusMeteringAction.Builder

Sets the OnAutoFocusListener to be notified when auto-focus completes.

Public methods

addPoint

@NonNull open fun addPoint(@NonNull point: MeteringPoint): FocusMeteringAction.Builder

Adds another MeteringPoint with default MeteringMode.

addPoint

@NonNull open fun addPoint(@NonNull point: MeteringPoint, @NonNull mode: FocusMeteringAction.MeteringMode): FocusMeteringAction.Builder

Adds another MeteringPoint with specified MeteringMode.

build

@NonNull open fun build(): FocusMeteringAction

Builds the FocusMeteringAction instance.

disableAutoCancel

@NonNull open fun disableAutoCancel(): FocusMeteringAction.Builder

Disables the auto-cancel.

from

@NonNull open static fun from(@NonNull meteringPoint: MeteringPoint): FocusMeteringAction.Builder

Creates the Builder from a MeteringPoint with default MeteringMode.

from

@NonNull open static fun from(@NonNull meteringPoint: MeteringPoint, @NonNull mode: FocusMeteringAction.MeteringMode): FocusMeteringAction.Builder

Creates the Builder from a MeteringPoint and MeteringMode

setAutoCancelDuration

@NonNull open fun setAutoCancelDuration(duration: Long, @NonNull timeUnit: TimeUnit): FocusMeteringAction.Builder

Sets the auto-cancel duration. After set, CameraControl#cancelFocusAndMetering() will be called in specified duration. By default, auto-cancel is enabled with 5 seconds duration.

setAutoFocusCallback

@NonNull open fun setAutoFocusCallback(@NonNull listener: FocusMeteringAction.OnAutoFocusListener): FocusMeteringAction.Builder

Sets the OnAutoFocusListener to be notified when auto-focus completes. The listener is called on main thread.

setAutoFocusCallback

@NonNull open fun setAutoFocusCallback(@NonNull executor: Executor, @NonNull listener: FocusMeteringAction.OnAutoFocusListener): FocusMeteringAction.Builder

Sets the OnAutoFocusListener to be notified when auto-focus completes. The listener is called on specified Executor.