public void initDiskCache(){
  if (DEBUG) {
    Log.d(TAG,"initDiskCache " + this);
  }
synchronized (mDiskCacheLock) {
    if (mDiskLruCache == null || mDiskLruCache.isClosed()) {
      if (mDiskCacheDir != null) {
        if (!mDiskCacheDir.exists()) {
          mDiskCacheDir.mkdirs();
        }
        try {
          mDiskLruCache=DiskLruCache.open(mDiskCacheDir,1,1,mDiskCacheSize);
          if (DEBUG) {
            Log.d(TAG,"Disk cache initialized " + this);
          }
        }
 catch (        final IOException e) {
          Log.e(TAG,"initDiskCache - " + e);
        }
      }
    }
    mDiskCacheStarting=false;
    mDiskCacheReady=true;
    mDiskCacheLock.notifyAll();
  }
}

public void initDiskCache ( ) { if ( DEBUG ) { Log . d ( TAG , "initDiskCache " + this ) ; } synchronized ( mDiskCacheLock ) { if ( mDiskLruCache == null || mDiskLruCache . isClosed ( ) ) { if ( mDiskCacheDir != null ) { if ( ! mDiskCacheDir . exists ( ) ) { mDiskCacheDir . mkdirs ( ) ; } try { mDiskLruCache = DiskLruCache . open ( mDiskCacheDir , 1 , 1 , mDiskCacheSize ) ; if ( DEBUG ) { Log . d ( TAG , "Disk cache initialized " + this ) ; } } catch ( final IOException e ) { Log . e ( TAG , "initDiskCache - " + e ) ; } } } mDiskCacheStarting = false ; mDiskCacheReady = true ; mDiskCacheLock . notifyAll ( ) ; } }
initializes the disk cache . note that this includes disk access so this should not be executed on the main / ui thread . by default an imageprovider does not initialize the disk cache when it is created , instead you should call initdiskcache ( ) to initialize it on a background thread .
