abstract class Source

Source of encoded image data.

References the data that will be used to decode a Drawable or Bitmap in #decodeDrawable or #decodeBitmap. Constructing a Source (with one of the overloads of createSource) can be done on any thread because the construction simply captures values. The real work is done in #decodeDrawable or #decodeBitmap.

A Source object can be reused to create multiple versions of the same image. For example, to decode a full size image and its thumbnail, the same Source can be used once with no OnHeaderDecodedListener and once with an implementation of onHeaderDecoded that calls setTargetSize with smaller dimensions. One Source can even be used simultaneously in multiple threads.

Summary

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.