Added in API level 28

OnPartialImageListener


interface OnPartialImageListener
android.graphics.ImageDecoder.OnPartialImageListener

Interface for inspecting a DecodeException and potentially preventing it from being thrown.

If an instance is passed to setOnPartialImageListener, a DecodeException that would otherwise have been thrown can be inspected inside onPartialImage. If onPartialImage returns true, a partial image will be created.

Summary

Public methods
abstract Boolean

Called by ImageDecoder when there is only a partial image to display.

Public methods

onPartialImage

Added in API level 28
abstract fun onPartialImage(exception: ImageDecoder.DecodeException): Boolean

Called by ImageDecoder when there is only a partial image to display.

If decoding is interrupted after having decoded a partial image, this method will be called. The implementation can inspect the DecodeException and optionally finish the rest of the decode creation process to create a partial Drawable or Bitmap.

Parameters
exception ImageDecoder.DecodeException: exception containing information about the decode interruption. This value cannot be null.
Return
Boolean true to create and return a Drawable or Bitmap with partial data. false (which is the default) to abort the decode and throw e. Any undecoded lines in the image will be blank.