ViewfinderSurfaceRequest.Builder


public final class ViewfinderSurfaceRequest.Builder


Builder for ViewfinderSurfaceRequest.

Summary

Public constructors

Constructor for Builder.

Builder(@NonNull Size resolution)

Constructor for Builder.

Constructor for Builder.

Extension functions

final @NonNull ViewfinderSurfaceRequest.Builder

This method is deprecated. Use androidx.camera.viewfinder.surface.ViewfinderSurfaceRequest as argument

Public constructors

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public Builder(@NonNull ViewfinderSurfaceRequest.Builder builder)

Constructor for Builder.

Creates a builder with other builder instance. The returned builder will be pre-populated with the state of the provided builder.

Parameters
@NonNull ViewfinderSurfaceRequest.Builder builder

Builder instance.

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public Builder(@NonNull Size resolution)

Constructor for Builder.

Creates a builder with viewfinder resolution.

Parameters
@NonNull Size resolution

viewfinder resolution.

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public Builder(@NonNull ViewfinderSurfaceRequest surfaceRequest)

Constructor for Builder.

Creates a builder with other ViewfinderSurfaceRequest instance. The returned builder will be pre-populated with the state of the provided ViewfinderSurfaceRequest instance.

Parameters
@NonNull ViewfinderSurfaceRequest surfaceRequest

ViewfinderSurfaceRequest instance.

Public methods

setImplementationMode

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public @NonNull ViewfinderSurfaceRequest.Builder setImplementationMode(
    @Nullable CameraViewfinder.ImplementationMode implementationMode
)

Sets the androidx.camera.viewfinder.CameraViewfinder.ImplementationMode.

Possible values:

If not set or setting to null, the androidx.camera.viewfinder.CameraViewfinder.ImplementationMode set via app :implementationMode in layout xml will be used for CameraViewfinder. If not set in the layout xml, the default value PERFORMANCE will be used in CameraViewfinder.

Parameters
@Nullable CameraViewfinder.ImplementationMode implementationMode

The .

Returns
@NonNull ViewfinderSurfaceRequest.Builder

This builder.

setLensFacing

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public @NonNull ViewfinderSurfaceRequest.Builder setLensFacing(int lensFacing)

Sets the lens facing.

Possible values:

The value can be retrieved from CameraCharacteristics by key LENS_FACING. If not set, LENS_FACING_BACK will be used by default.

Parameters
int lensFacing

The lens facing.

Returns
@NonNull ViewfinderSurfaceRequest.Builder

This builder.

setSensorOrientation

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
public @NonNull ViewfinderSurfaceRequest.Builder setSensorOrientation(int sensorOrientation)

Sets the sensor orientation.

Range of valid values: 0, 90, 180, 270

The value can be retrieved from CameraCharacteristics by key SENSOR_ORIENTATION. If it is not set, 0 will be used by default.

Parameters
int sensorOrientation

The camera sensor orientation.

Returns
@NonNull ViewfinderSurfaceRequest.Builder

this builder.

Extension functions

ViewfinderSurfaceRequestUtil.populateFromCharacteristics

public final @NonNull ViewfinderSurfaceRequest.Builder ViewfinderSurfaceRequestUtil.populateFromCharacteristics(
    @NonNull ViewfinderSurfaceRequest.Builder receiver,
    @NonNull CameraCharacteristics cameraCharacteristics
)

Populates ViewfinderSurfaceRequest.Builder from CameraCharacteristics.

The CameraCharacteristics will be used to populate information including lens facing, sensor orientation and ImplementationMode. If the hardware level is legacy, the ImplementationMode will be set to ImplementationMode.COMPATIBLE.