Google is committed to advancing racial equity for Black communities. See how.

PreviewView.ImplementationMode

public static final enum PreviewView.ImplementationMode
extends Enum<PreviewView.ImplementationMode>

java.lang.Object
   ↳ java.lang.Enum<androidx.camera.view.PreviewView.ImplementationMode>
     ↳ androidx.camera.view.PreviewView.ImplementationMode


The implementation mode of a PreviewView.

User preference on how the PreviewView should render the preview. PreviewView displays the preview with either a SurfaceView or a TextureView. A SurfaceView is generally better than a TextureView when it comes to certain key metrics, including power and latency. On the other hand, TextureView is better supported by a wider range of devices. The option is used by PreviewView to decide what is the best internal implementation given the device capabilities and user configurations.

Summary

Enum values

PreviewView.ImplementationMode  COMPATIBLE

Use a TextureView for the preview. 

PreviewView.ImplementationMode  PERFORMANCE

Use a SurfaceView for the preview when possible. 

Public methods

static PreviewView.ImplementationMode valueOf(String name)
static final ImplementationMode[] values()

Inherited methods

Enum values

COMPATIBLE

public static final PreviewView.ImplementationMode COMPATIBLE

Use a TextureView for the preview.

PERFORMANCE

public static final PreviewView.ImplementationMode PERFORMANCE

Use a SurfaceView for the preview when possible. If the device doesn't support SurfaceView, PreviewView will fall back to use a TextureView instead.

PreviewView falls back to TextureView when the API level is 24 or lower, the camera hardware is CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, or Preview.getTargetRotation() is different from PreviewView's display rotation.

Do not use this mode if Preview.Builder.setTargetRotation(int) is set to a value different than the display's rotation, because SurfaceView does not support arbitrary transformation. Do not use this mode if the PreviewView needs to be animated. SurfaceView animation is not supported on API level 24 or lower. Also, for streaming state provided in PreviewView.getPreviewStreamState(), the PreviewView.StreamState.STREAMING state might happen prematurely if this mode is used.

Public methods

valueOf

public static PreviewView.ImplementationMode valueOf (String name)

Parameters
name String

Returns
PreviewView.ImplementationMode

values

public static final ImplementationMode[] values ()

Returns
ImplementationMode[]