List of usage examples for android.support.v4.util LongSparseArray delete
public void delete(long j)
From source file:android.content.res.VectorResources.java
private Drawable getCachedDrawable(LongSparseArray<WeakReference<Drawable.ConstantState>> drawableCache, long key) { synchronized (mAccessLock) { WeakReference<Drawable.ConstantState> wr = drawableCache.get(key); if (wr != null) { // we have the key Drawable.ConstantState entry = wr.get(); if (entry != null) { //Log.i(TAG, "Returning cached drawable @ #" + // Integer.toHexString(((Integer)key).intValue()) // + " in " + this + ": " + entry); return entry.newDrawable(this); } else { // our entry has been purged drawableCache.delete(key); }/* www. j a v a 2s .co m*/ } } return null; }
From source file:android.support.v7.widget.AppCompatDrawableManager.java
private Drawable getCachedDrawable(@NonNull final Context context, final long key) { synchronized (mDrawableCacheLock) { final LongSparseArray<WeakReference<ConstantState>> cache = mDrawableCaches.get(context); if (cache == null) { return null; }/* w w w .jav a 2 s .c om*/ final WeakReference<ConstantState> wr = cache.get(key); if (wr != null) { // We have the key, and the secret ConstantState entry = wr.get(); if (entry != null) { return entry.newDrawable(context.getResources()); } else { // Our entry has been purged cache.delete(key); } } } return null; }