Bitmap在API Level 1中就已经有了, 只不过随着SDK更新, Google对它的一些内外部接口/实现进行了一些优化或者调整, 主要是内存资源的管理方面. java
- On Android Android 2.2 (API level 8) and lower, when garbage collection occurs, your app's threads get stopped. This causes a lag that can degrade performance. Android 2.3 adds concurrent garbage collection, which means that the memory is reclaimed soon after a bitmap is no longer referenced.
- On Android 2.3.3 (API level 10) and lower, the backing pixel data for a bitmap is stored in native memory. It is separate from the bitmap itself, which is stored in the Dalvik heap. The pixel data in native memory is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash. As of Android 3.0 (API level 11), the pixel data is stored on the Dalvik heap along with the associated bitmap.
上述都只是针对单个Bitmap的内存管理, 可是在开发中, 不免会须要管理大量的Bitmap, 那应该怎么办? 缓存
在API Level 12中, 能够经过LruCache来缓存大量的内存Bitmap. 除此以外, 在Android源码中, 能够找到, 一个名为DiskLruCache的类, 它能够文件形式缓存Bitmap. app
Google Taining 优化