ImageCapture.OnImageSavedCallback


interface ImageCapture.OnImageSavedCallback


Listener containing callbacks for image file I/O events.

Summary

Public functions

Unit

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

Unit

Called when the capture is started.

Unit

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

Unit

Called when an image has been successfully saved.

Unit

Callback to notify that the postview bitmap is available.

Public functions

onCaptureProcessProgressed

Added in 1.4.0
fun onCaptureProcessProgressed(progress: Int): Unit

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
progress: Int

the progress ranging from 0 to 100.

onCaptureStarted

Added in 1.4.0
fun onCaptureStarted(): Unit

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
fun onError(exception: ImageCaptureException): Unit

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

Parameters
exception: ImageCaptureException

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

onImageSaved

Added in 1.0.0
fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults): Unit

Called when an image has been successfully saved.

onPostviewBitmapAvailable

Added in 1.4.0
fun onPostviewBitmapAvailable(bitmap: Bitmap): Unit

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
bitmap: Bitmap

the postview bitmap.