Stay organized with collections
Save and categorize content based on your preferences.
interface OnHeaderDecodedListener
Interface for changing the default settings of a decode.
Supply an instance to decodeDrawable
or decodeBitmap
, which will call onHeaderDecoded
(in the same thread) once the size is known. The implementation of onHeaderDecoded
can then change the decode settings as desired.
Summary
Public methods |
abstract Unit |
Called by ImageDecoder when the header has been decoded and the image size is known.
|
Public methods
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.OnHeaderDecodedListener\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnHeaderDecodedListener\n=======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/graphics/ImageDecoder.OnHeaderDecodedListener \"View this page in Java\") \n\n```\ninterface OnHeaderDecodedListener\n```\n\n|------------------------------------------------------------|\n| [android.graphics.ImageDecoder.OnHeaderDecodedListener](#) |\n\nInterface for changing the default settings of a decode.\n\nSupply an instance to [decodeDrawable](/reference/kotlin/android/graphics/ImageDecoder#decodeDrawable(android.graphics.ImageDecoder.Source,%20android.graphics.ImageDecoder.OnHeaderDecodedListener)) or [decodeBitmap](/reference/kotlin/android/graphics/ImageDecoder#decodeBitmap(android.graphics.ImageDecoder.Source,%20android.graphics.ImageDecoder.OnHeaderDecodedListener)), which will call [onHeaderDecoded](#onHeaderDecoded(android.graphics.ImageDecoder,%20android.graphics.ImageDecoder.ImageInfo,%20android.graphics.ImageDecoder.Source)) (in the same thread) once the size is known. The implementation of [onHeaderDecoded](#onHeaderDecoded(android.graphics.ImageDecoder,%20android.graphics.ImageDecoder.ImageInfo,%20android.graphics.ImageDecoder.Source)) can then change the decode settings as desired.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onHeaderDecoded](#onHeaderDecoded(android.graphics.ImageDecoder,%20android.graphics.ImageDecoder.ImageInfo,%20android.graphics.ImageDecoder.Source))`(`decoder:` `[ImageDecoder](/reference/kotlin/android/graphics/ImageDecoder)`, `info:` `[ImageDecoder.ImageInfo](/reference/kotlin/android/graphics/ImageDecoder.ImageInfo)`, `source:` `[ImageDecoder.Source](/reference/kotlin/android/graphics/ImageDecoder.Source)`)` Called by [ImageDecoder](/reference/kotlin/android/graphics/ImageDecoder) when the header has been decoded and the image size is known. |\n\nPublic methods\n--------------\n\n### onHeaderDecoded\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onHeaderDecoded(\n decoder: ImageDecoder, \n info: ImageDecoder.ImageInfo, \n source: ImageDecoder.Source\n): Unit\n```\n\nCalled by [ImageDecoder](/reference/kotlin/android/graphics/ImageDecoder) when the header has been decoded and the image size is known.\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `decoder` | [ImageDecoder](/reference/kotlin/android/graphics/ImageDecoder): the object performing the decode, for changing its default settings. This value cannot be `null`. |\n| `info` | [ImageDecoder.ImageInfo](/reference/kotlin/android/graphics/ImageDecoder.ImageInfo): information about the encoded image. This value cannot be `null`. |\n| `source` | [ImageDecoder.Source](/reference/kotlin/android/graphics/ImageDecoder.Source): object that created `decoder`. This value cannot be `null`. |"]]