Example usage for android.content Context getExternalCacheDir

List of usage examples for android.content Context getExternalCacheDir

Introduction

In this page you can find the example usage for android.content Context getExternalCacheDir.

Prototype

@Nullable
public abstract File getExternalCacheDir();

Source Link

Document

Returns absolute path to application-specific directory on the primary shared/external storage device where the application can place cache files it owns.

Usage

From source file:com.wowcow.chat10.imagecache.ImageCache.java

/**
 * Get the external app cache directory.
 * /*from ww  w .j a  v a2 s .com*/
 * @param context
 *          The context to use
 * @return The external cache dir
 */
public static File getExternalCacheDir(Context context) {
    if (context.getExternalCacheDir() == null) {
        return context.getCacheDir();
    } else {
        return context.getExternalCacheDir();
    }
}

From source file:com.wewe.android.util.video.ImageCache.java

/**
 * Get the external app cache directory.
 * //w w w.  jav a2 s  .  c o m
 * @param context
 *            The context to use
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (VersionUtil.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.android.volley.plus.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use// w w w . java  2s. c  o m
 * @return The external cache dir
 */
//    @TargetApi(8)
public static File getExternalCacheDir(Context context) {
    if (OsVersionUtils.hasFroyo()) {
        File file = context.getExternalCacheDir();
        if (file != null)
            return file;
    }

    // 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.codingPower.framework.worker.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use/*from  ww w .  j a  v a 2 s  .  com*/
 * @return The external cache dir
 */
public static File getExternalCacheDir(Context context) {
    if (ActivityUtil.hasFroyo()) {
        return context.getExternalCacheDir();
    }

    // Before Froyo we need to construct the external cache dir ourselves
    final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/";
    File res = new File(Environment.getExternalStorageDirectory().getPath() + cacheDir);
    System.out.println(res);
    return res;
}

From source file:com.vstar.lib.io.ImageCache.java

/**
 * Get the external app cache directory.
 * //from w  w w . j  a va 2s  .c om
 * @param context
 *            The context to use
 * @return The external cache dir
 */
@TargetApi(8)
public static File getExternalCacheDir(Context context) {
    File external = context.getExternalCacheDir();
    if (UIUtils.hasFroyo() && external != null) {
        return external;
    }

    // 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:cn.mimail.sdk.cache.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//from ww w .jav  a 2  s  .  c om
 * @return The external cache dir
 */
@TargetApi(8)
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.app.jiaxiaotong.im.utils.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context/*from  w  ww .jav a 2 s  .  com*/
 *            The context to use
 * @return The external cache dir
 */
@TargetApi(Build.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.easemob.chatui.video.util.ImageCache.java

/**
 * Get the external app cache directory.
 * //from  w w  w .  j  a v a 2 s  .  c om
 * @param context
 *            The context to use
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (com.easemob.chatui.video.util.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.sythealth.fitness.util.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use// ww  w  .j  a  v  a  2s .  c  o  m
 * @return The external cache dir
 */
@TargetApi(8)
public static File getExternalCacheDir(Context context) {
    if (Utils.hasFroyo()) {
        File file = context.getExternalCacheDir();
        if (file != null) {
            return file;
        }
    }

    // Before Froyo we need to construct the external cache dir ourselves
    final String cacheDir = "/Android/data/data/" + context.getPackageName() + "/cache/";
    return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir);
}

From source file:android.support.asy.image.ImageCache.java

/**
 * Get the external app cache directory.
 * /*from www .j  a  v  a 2  s  .co  m*/
 * @param context
 *            The context to use
 * @return The external cache dir
 */
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);
}