@ TargetApi ( Build . VERSION_CODES . FROYO ) public static File getExternalCacheDir ( Context context ) { if ( Version . hasFroyo ( ) ) { File path = context . getExternalCacheDir ( ) ; // In some case, even the sd card is mounted, getExternalCacheDir will return null, may be it is nearly full. if ( path != null ) { return path ; } } // Before Froyo or the path is null, we need to construct the external cache folder ourselves final String cacheDir = "/Android/data/" + context . getPackageName ( ) + "/cache/" ; return new File ( Environment . getExternalStorageDirectory ( ) . getPath ( ) + cacheDir ) ; }
Get the external application cache directory .