List of usage examples for android.content Context getExternalCacheDir
@Nullable public abstract File getExternalCacheDir();
From source file:at.fjp.cards.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use/*from w w w . ja v a 2 s. c o m*/ * @return The external cache dir */ @TargetApi(VERSION_CODES.FROYO) public static File getExternalCacheDir(Context context) { return context.getExternalCacheDir(); }
From source file:imageUtils.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use// ww w. jav a 2 s . c om * @return The external cache dir */ @SuppressLint("NewApi") @TargetApi(VERSION_CODES.FROYO) public static File getExternalCacheDir(Context context) { if (Utils.hasFroyo()) { return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:com.jasper.image.imagemanager.imagehelper.imageEngine.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use//from w w w. j av a2 s . com * @return The external cache dir */ public static File getExternalCacheDir(Context context) { return context.getExternalCacheDir(); }
From source file:ar.com.lapotoca.resiliencia.gallery.util.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use/*ww w . j a v a 2 s . co m*/ * @return The external cache dir */ public static File getExternalCacheDir(Context context) { return context.getExternalCacheDir(); }
From source file:us.happ.bitmap.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use//from w w w . ja v a2s .c om * @return The external cache dir */ @TargetApi(8) public static File getExternalCacheDir(Context context) { if (Happ.hasFroyo) { return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:com.wetrain.client.customviews.imagecache.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use//from w w w.j a va 2 s . c om * @return The external cache dir */ @TargetApi(8) public static File getExternalCacheDir(Context context) { if (Utills.hasFroyo()) { return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:com.androidsx.imagesearch.util.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use//w w w. j a v a 2 s . c o m * @return The external cache dir */ @TargetApi(8) public static File getExternalCacheDir(Context context) { if (Platform.hasFroyo()) { return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:com.skyworth.httputil.imageloadutil.ImageCache.java
/** * Get the external app cache directory. * * @param context The context to use//ww w .j a v a 2 s. co m * @return The external cache dir */ @TargetApi(8) public static File getExternalCacheDir(Context context) { if (Utils.hasFroyo()) { Log.i(".....", "======================================"); return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; Log.i(".....", cacheDir); return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); }
From source file:com.example.genshib.mymapproject.AndroidSupportUtil.java
/** * Returns if it is required to ask for runtime permission for accessing a directory. * * @param context the activity asking//from w ww. j a va2 s . co m * @param directory the directory accessed * @return true if runtime permission must be asked for */ public static boolean runtimePermissionRequiredForReadExternalStorage(Context context, File directory) { if (runtimePermissionRequired(context, android.Manifest.permission.READ_EXTERNAL_STORAGE)) { try { String canonicalPath = directory.getCanonicalPath(); // not sure if this covers all possibilities: file is freely accessible if it is in the application external cache or external files // dir or somewhere else (e.g. internal storage) but not in the general external storage. return canonicalPath.startsWith(Environment.getExternalStorageDirectory().getCanonicalPath()) && !canonicalPath.startsWith(context.getExternalCacheDir().getCanonicalPath()) && !canonicalPath.startsWith(context.getExternalFilesDir(null).getCanonicalPath()); } catch (IOException e) { LOGGER.warning("Directory access exception " + directory.toString() + e.getMessage()); return true; // ?? it probably means the file cannot be found } } return false; }
From source file:org.mapsforge.map.android.util.AndroidSupportUtil.java
/** * Returns if it is required to ask for runtime permission for accessing a directory. * @param context the activity asking/*from ww w.j a v a 2 s . c o m*/ * @param directory the directory accessed * @return true if runtime permission must be asked for */ public static boolean runtimePermissionRequiredForReadExternalStorage(Context context, File directory) { if (runtimePermissionRequired(context, Manifest.permission.READ_EXTERNAL_STORAGE)) { try { String canonicalPath = directory.getCanonicalPath(); // not sure if this covers all possibilities: file is freely accessible if it is in the application external cache or external files // dir or somewhere else (e.g. internal storage) but not in the general external storage. return canonicalPath.startsWith(Environment.getExternalStorageDirectory().getCanonicalPath()) && !canonicalPath.startsWith(context.getExternalCacheDir().getCanonicalPath()) && !canonicalPath.startsWith(context.getExternalFilesDir(null).getCanonicalPath()); } catch (IOException e) { LOGGER.warning("Directory access exception " + directory.toString() + e.getMessage()); return true; // ?? it probably means the file cannot be found } } return false; }