public static Drawable getCachedArtwork( Context context, long artIndex, BitmapDrawable defaultArtwork) { Drawable d = null; synchronized (sArtCache) { d = sArtCache.get(artIndex); } if (d == null) { d = defaultArtwork; final Bitmap icon = defaultArtwork.getBitmap(); int w = icon.getWidth(); int h = icon.getHeight(); Bitmap b = MusicUtils.getArtworkQuick(context, artIndex, w, h); if (b != null) { d = new FastBitmapDrawable(b); synchronized (sArtCache) { // the cache may have changed since we checked Drawable value = sArtCache.get(artIndex); if (value == null) { sArtCache.put(artIndex, d); } else { d = value; } } } } return d; }