のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

clearDrawableCache

   1503     private void clearDrawableCache(
   1504             LongSparseArray<WeakReference<ConstantState>> cache,
   1505             int configChanges) {
   1506         int N = cache.size();
   1507         if (DEBUG_CONFIG) {
   1508             Log.d(TAG, "Cleaning up drawables config changes: 0x"
   1509                     + Integer.toHexString(configChanges));
   1510         }
   1511         for (int i=0; i<N; i++) {
   1512             WeakReference<Drawable.ConstantState> ref = cache.valueAt(i);
   1513             if (ref != null) {
   1514                 Drawable.ConstantState cs = ref.get();
   1515                 if (cs != null) {
   1516                     if (Configuration.needNewResources(
   1517                             configChanges, cs.getChangingConfigurations())) {
   1518                         if (DEBUG_CONFIG) {
   1519                             Log.d(TAG, "FLUSHING #0x"
   1520                                     + Long.toHexString(mDrawableCache.keyAt(i))
   1521                                     + " / " + cs + " with changes: 0x"
   1522                                     + Integer.toHexString(cs.getChangingConfigurations()));
   1523                         }
   1524                         cache.setValueAt(i, null);
   1525                     } else if (DEBUG_CONFIG) {
   1526                         Log.d(TAG, "(Keeping #0x"
   1527                                 + Long.toHexString(cache.keyAt(i))
   1528                                 + " / " + cs + " with changes: 0x"
   1529                                 + Integer.toHexString(cs.getChangingConfigurations())
   1530                                 + ")");
   1531                     }
   1532                 }
   1533             }
   1534         }
   1535     }