OnImageCapturedListener

abstract class OnImageCapturedListener
kotlin.Any
   ↳ androidx.camera.core.ImageCapture.OnImageCapturedListener

Listener called when an image capture has completed.

Summary

Public constructors

Listener called when an image capture has completed.

Public methods

open Unit
onCaptureSuccess(image: ImageProxy!, rotationDegrees: Int)

Callback for when the image has been captured.

open Unit
onError(@NonNull imageCaptureError: ImageCapture.ImageCaptureError, @NonNull message: String, @Nullable cause: Throwable?)

Callback for when an error occurred during image capture.

Public constructors

<init>

OnImageCapturedListener()

Listener called when an image capture has completed.

Public methods

onCaptureSuccess

open fun onCaptureSuccess(image: ImageProxy!, rotationDegrees: Int): Unit

Callback for when the image has been captured.

The application is responsible for calling ImageProxy#close() to close the image.

The image is of format ImageFormat#JPEG, queryable via ImageProxy#getFormat().

The image is provided as captured by the underlying ImageReader without rotation applied. rotationDegrees describes the magnitude of clockwise rotation, which if applied to the image will make it match the currently configured target rotation.

For example, if the current target rotation is set to the display rotation, rotationDegrees is the rotation to apply to the image to match the display orientation. A rotation of 90 degrees would mean rotating the image 90 degrees clockwise produces an image that will match the display orientation.

See also ImageCaptureConfig.Builder#setTargetRotation(int) and setTargetRotation(int).

Parameters
image ImageProxy!: The captured image
rotationDegrees ImageProxy!: The rotation which if applied to the image will make it match the current target rotation. rotationDegrees is expressed as one of Surface#ROTATION_0, Surface#ROTATION_90, Surface#ROTATION_180, or Surface#ROTATION_270.

onError

open fun onError(@NonNull imageCaptureError: ImageCapture.ImageCaptureError, @NonNull message: String, @Nullable cause: Throwable?): Unit

Callback for when an error occurred during image capture.