The second Android 11 Developer Preview is now available, test it out and share your feedback.

PreviewExtender

public abstract class PreviewExtender
extends Object

java.lang.Object
   ↳ androidx.camera.extensions.PreviewExtender


Class for using an OEM provided extension on preview.

Summary

Public constructors

PreviewExtender()

Public methods

void enableExtension(CameraSelector cameraSelector)

Enables the derived image capture extension feature.

boolean isExtensionAvailable(CameraSelector cameraSelector)

Indicates whether extension function can support with the given CameraSelector.

Inherited methods

Public constructors

PreviewExtender

public PreviewExtender ()

Public methods

enableExtension

public void enableExtension (CameraSelector cameraSelector)

Enables the derived image capture extension feature. If the extension can't be applied on any of the cameras specified with the given CameraSelector, it will be no-ops.

Enabling extensions on Preview may limit the number of cameras which can be selected when the Preview is used as a parameter to bindToLifecycle. BindToLifecycle will throw an exception if no cameras are found that support the extension.

Preview extension has dependence on image capture extension. A IMAGE_CAPTURE_EXTENSION_REQUIRED error will be thrown if corresponding image capture extension is not enabled together.

Parameters
cameraSelector CameraSelector: The selector used to determine the camera for which to enable extensions.

isExtensionAvailable

public boolean isExtensionAvailable (CameraSelector cameraSelector)

Indicates whether extension function can support with the given CameraSelector.

Parameters
cameraSelector CameraSelector: The selector that determines a camera that will be checked for the availability of extensions.

Returns
boolean True if the specific extension function is supported for the camera device.