Loading docs/downloads/training/BitmapFun.zip +183 B (102 KiB) File changed.No diff preview for this file type. View original file View changed file docs/html/training/displaying-bitmaps/manage-memory.jd +24 −21 Original line number Diff line number Diff line Loading @@ -160,13 +160,14 @@ a soft reference to the bitmap is placed in a {@link java.util.HashSet}, for possible reuse later with {@link android.graphics.BitmapFactory.Options#inBitmap}: <pre>HashSet<SoftReference<Bitmap>> mReusableBitmaps; <pre>Set<SoftReference<Bitmap>> mReusableBitmaps; private LruCache<String, BitmapDrawable> mMemoryCache; // If you're running on Honeycomb or newer, create // a HashSet of references to reusable bitmaps. // If you're running on Honeycomb or newer, create a // synchronized HashSet of references to reusable bitmaps. if (Utils.hasHoneycomb()) { mReusableBitmaps = new HashSet<SoftReference<Bitmap>>(); mReusableBitmaps = Collections.synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemoryCache = new LruCache<String, BitmapDrawable>(mCacheParams.memCacheSize) { Loading Loading @@ -243,6 +244,7 @@ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) { Bitmap bitmap = null; if (mReusableBitmaps != null && !mReusableBitmaps.isEmpty()) { synchronized (mReusableBitmaps) { final Iterator<SoftReference<Bitmap>> iterator = mReusableBitmaps.iterator(); Bitmap item; Loading @@ -265,6 +267,7 @@ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) { } } } } return bitmap; }</pre> Loading Loading
docs/downloads/training/BitmapFun.zip +183 B (102 KiB) File changed.No diff preview for this file type. View original file View changed file
docs/html/training/displaying-bitmaps/manage-memory.jd +24 −21 Original line number Diff line number Diff line Loading @@ -160,13 +160,14 @@ a soft reference to the bitmap is placed in a {@link java.util.HashSet}, for possible reuse later with {@link android.graphics.BitmapFactory.Options#inBitmap}: <pre>HashSet<SoftReference<Bitmap>> mReusableBitmaps; <pre>Set<SoftReference<Bitmap>> mReusableBitmaps; private LruCache<String, BitmapDrawable> mMemoryCache; // If you're running on Honeycomb or newer, create // a HashSet of references to reusable bitmaps. // If you're running on Honeycomb or newer, create a // synchronized HashSet of references to reusable bitmaps. if (Utils.hasHoneycomb()) { mReusableBitmaps = new HashSet<SoftReference<Bitmap>>(); mReusableBitmaps = Collections.synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemoryCache = new LruCache<String, BitmapDrawable>(mCacheParams.memCacheSize) { Loading Loading @@ -243,6 +244,7 @@ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) { Bitmap bitmap = null; if (mReusableBitmaps != null && !mReusableBitmaps.isEmpty()) { synchronized (mReusableBitmaps) { final Iterator<SoftReference<Bitmap>> iterator = mReusableBitmaps.iterator(); Bitmap item; Loading @@ -265,6 +267,7 @@ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) { } } } } return bitmap; }</pre> Loading