PreviewConfig

public final class PreviewConfig
extends Object implements Config, UseCaseEventConfig

java.lang.Object
   ↳ androidx.camera.core.PreviewConfig


Configuration for a Preview use case.

Summary

Nested classes

class PreviewConfig.Builder

Builder for a PreviewConfig

Public methods

Executor getBackgroundExecutor(Executor valueIfMissing)

Returns the executor that will be used for background tasks.

Executor getBackgroundExecutor()

Returns the executor that will be used for background tasks.

CameraX.LensFacing getLensFacing(CameraX.LensFacing valueIfMissing)

Returns the lens-facing direction of the camera being configured.

CameraX.LensFacing getLensFacing()

Retrieves the lens facing direction for the primary camera to be configured.

AspectRatio getTargetAspectRatio(AspectRatio valueIfMissing)

Retrieves the aspect ratio of the target intending to use images from this configuration.

AspectRatio getTargetAspectRatio()

Retrieves the aspect ratio of the target intending to use images from this configuration.

String getTargetName()

Retrieves the name of the target object being configured.

String getTargetName(String valueIfMissing)

Retrieves the name of the target object being configured.

Size getTargetResolution()

Retrieves the resolution of the target intending to use from this configuration.

Size getTargetResolution(Size valueIfMissing)

Retrieves the resolution of the target intending to use from this configuration.

int getTargetRotation(int valueIfMissing)

Retrieves the rotation of the target intending to use images from this configuration.

int getTargetRotation()

Retrieves the rotation of the target intending to use images from this configuration.

Inherited methods

Public methods

getBackgroundExecutor

public Executor getBackgroundExecutor (Executor valueIfMissing)

Returns the executor that will be used for background tasks.

Parameters
valueIfMissing Executor: The value to return if this configuration option has not been set.

Returns
Executor The stored value or valueIfMissing if the value does not exist in this configuration.

getBackgroundExecutor

public Executor getBackgroundExecutor ()

Returns the executor that will be used for background tasks.

Returns
Executor The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing (CameraX.LensFacing valueIfMissing)

Returns the lens-facing direction of the camera being configured.

Parameters
valueIfMissing CameraX.LensFacing: The value to return if this configuration option has not been set.

Returns
CameraX.LensFacing The stored value or valueIfMissing if the value does not exist in this configuration.

getLensFacing

public CameraX.LensFacing getLensFacing ()

Retrieves the lens facing direction for the primary camera to be configured.

Returns
CameraX.LensFacing The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio (AspectRatio valueIfMissing)

Retrieves the aspect ratio of the target intending to use images from this configuration.

Parameters
valueIfMissing AspectRatio: The value to return if this configuration option has not been set.

Returns
AspectRatio The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetAspectRatio

public AspectRatio getTargetAspectRatio ()

Retrieves the aspect ratio of the target intending to use images from this configuration.

Returns
AspectRatio The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName ()

Retrieves the name of the target object being configured.

The name should be a value that can uniquely identify an instance of the object being configured.

Returns
String The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetName

public String getTargetName (String valueIfMissing)

Retrieves the name of the target object being configured.

The name should be a value that can uniquely identify an instance of the object being configured.

Parameters
valueIfMissing String: The value to return if this configuration option has not been set.

Returns
String The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetResolution

public Size getTargetResolution ()

Retrieves the resolution of the target intending to use from this configuration.

Returns
Size The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.

getTargetResolution

public Size getTargetResolution (Size valueIfMissing)

Retrieves the resolution of the target intending to use from this configuration.

Parameters
valueIfMissing Size: The value to return if this configuration option has not been set.

Returns
Size The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetRotation

public int getTargetRotation (int valueIfMissing)

Retrieves the rotation of the target intending to use images from this configuration.

This is one of four valid values: Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270. Rotation values are relative to the device's "natural" rotation, Surface.ROTATION_0.

Parameters
valueIfMissing int: The value to return if this configuration option has not been set.

Returns
int The stored value or valueIfMissing if the value does not exist in this configuration.

getTargetRotation

public int getTargetRotation ()

Retrieves the rotation of the target intending to use images from this configuration.

This is one of four valid values: Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, Surface.ROTATION_270. Rotation values are relative to the device's "natural" rotation, Surface.ROTATION_0.

Returns
int The stored value, if it exists in this configuration.

Throws
IllegalArgumentException if the option does not exist in this configuration.