Stay organized with collections
Save and categorize content based on your preferences.
ImageDecoder.OnPartialImageListener
public
static
interface
ImageDecoder.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
onPartialImage
public abstract boolean onPartialImage (ImageDecoder.DecodeException exception)
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 . |
Returns |
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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ImageDecoder.OnPartialImageListener\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nImageDecoder.OnPartialImageListener\n===================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/graphics/ImageDecoder.OnPartialImageListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nImageDecoder.OnPartialImageListener\n`\n\n\n`\n\n\n`\n\n|------------------------------------------------------|\n| android.graphics.ImageDecoder.OnPartialImageListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface for inspecting a [DecodeException](/reference/android/graphics/ImageDecoder.DecodeException)\nand potentially preventing it from being thrown.\n\nIf an instance is passed to\n[setOnPartialImageListener](/reference/android/graphics/ImageDecoder#setOnPartialImageListener(android.graphics.ImageDecoder.OnPartialImageListener)), a\n[DecodeException](/reference/android/graphics/ImageDecoder.DecodeException) that would otherwise have been\nthrown can be inspected inside\n[onPartialImage](/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException)).\nIf [onPartialImage](/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException)) returns\n`true`, a partial image will be created.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onPartialImage](/reference/android/graphics/ImageDecoder.OnPartialImageListener#onPartialImage(android.graphics.ImageDecoder.DecodeException))`(`[ImageDecoder.DecodeException](/reference/android/graphics/ImageDecoder.DecodeException)` exception) ` Called by [ImageDecoder](/reference/android/graphics/ImageDecoder) when there is only a partial image to display. |\n\nPublic methods\n--------------\n\n### onPartialImage\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onPartialImage (ImageDecoder.DecodeException exception)\n```\n\nCalled by [ImageDecoder](/reference/android/graphics/ImageDecoder) when there is only a partial image to\ndisplay.\n\nIf decoding is interrupted after having decoded a partial image,\nthis method will be called. The implementation can inspect the\n[DecodeException](/reference/android/graphics/ImageDecoder.DecodeException) and optionally finish the\nrest of the decode creation process to create a partial [Drawable](/reference/android/graphics/drawable/Drawable)\nor [Bitmap](/reference/android/graphics/Bitmap).\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `exception` | `ImageDecoder.DecodeException`: exception containing information about the decode interruption. This value cannot be `null`. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `boolean` | `true` to create and return a [Drawable](/reference/android/graphics/drawable/Drawable) or [Bitmap](/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. \u003cbr /\u003e |"]]