ImageCapture.OnImageSavedCallback

public interface ImageCapture.OnImageSavedCallback


Listener containing callbacks for image file I/O events.

Summary

Public methods

default void

Callback to report the progress of the capture's processing.

default void

Called when the capture is started.

abstract void

Called when an error occurs while attempting to save an image.

abstract void

Called when an image has been successfully saved.

default void

Callback to notify that the postview bitmap is available.

Public methods

onCaptureProcessProgressed

Added in 1.4.0-alpha04
default void onCaptureProcessProgressed(int progress)

Callback to report the progress of the capture's processing.

To know in advanced if this callback will be invoked or not, check the capabilities by getImageCaptureCapabilities and isCaptureProcessProgressSupported. If supported, this callback will be called multiple times with monotonically increasing values. At the minimum the callback will be called once with value 100 to indicate the processing is finished. This callback will always be called before onImageSaved.

Parameters
int progress

the progress ranging from 0 to 100.

onCaptureStarted

Added in 1.4.0-alpha04
default void onCaptureStarted()

Called when the capture is started.

This callback is guaranteed to be called once and before onImageSaved for the same invocation of takePicture.

It's recommended to play shutter sound or trigger UI indicators of capture when receiving this callback.

onError

Added in 1.0.0
abstract void onError(@NonNull ImageCaptureException exception)

Called when an error occurs while attempting to save an image.

Parameters
@NonNull ImageCaptureException exception

An ImageCaptureException that contains the type of error, the error message and the throwable that caused it.

onImageSaved

Added in 1.0.0
abstract void onImageSaved(@NonNull ImageCapture.OutputFileResults outputFileResults)

Called when an image has been successfully saved.

onPostviewBitmapAvailable

Added in 1.4.0-alpha04
default void onPostviewBitmapAvailable(@NonNull Bitmap bitmap)

Callback to notify that the postview bitmap is available. The postview is intended to be shown on UI before the long-processing capture is completed in order to provide a better UX.

The postview is only available when the isPostviewSupported returns true for the specified CameraInfo and applications must explicitly enable the postview using the setPostviewEnabled. This callback will be called before onImageSaved. But if something goes wrong when processing the postview, this callback method could be skipped.

The bitmap is rotated according to the target rotation set to the ImageCapture to make it upright. If target rotation is not set, the display rotation is used.

See also setTargetRotation and setTargetRotation.

Parameters
@NonNull Bitmap bitmap

the postview bitmap.