Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# ImageDecoder.OnPartialImageListener

*** ** * ** ***


`
public
static


interface
ImageDecoder.OnPartialImageListener
`


`


`

|---|
| android.graphics.ImageDecoder.OnPartialImageListener |

<br />

*** ** * ** ***

Interface for inspecting a `https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException`
and potentially preventing it from being thrown.

If an instance is passed to
`https://developer.android.com/reference/android/graphics/ImageDecoder#setOnPartialImageListener(android.graphics.ImageDecoder.OnPartialImageListener)`, a
`https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException` that would otherwise have been
thrown can be inspected inside
`https://developer.android.com/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException)`.
If `https://developer.android.com/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException)` returns
`true`, a partial image will be created.

## Summary

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException)(https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException exception) ` Called by `https://developer.android.com/reference/android/graphics/ImageDecoder` when there is only a partial image to display. |

## Public methods

### onPartialImage

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean onPartialImage (ImageDecoder.DecodeException exception)
```

Called by `https://developer.android.com/reference/android/graphics/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
`https://developer.android.com/reference/android/graphics/ImageDecoder.DecodeException` and optionally finish the
rest of the decode creation process to create a partial `https://developer.android.com/reference/android/graphics/drawable/Drawable`
or `https://developer.android.com/reference/android/graphics/Bitmap`.

<br />

| Parameters ||
|---|---|
| `exception` | `ImageDecoder.DecodeException`: exception containing information about the decode interruption. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` to create and return a `https://developer.android.com/reference/android/graphics/drawable/Drawable` or `https://developer.android.com/reference/android/graphics/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. <br /> |