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.chatitzemoumin.londoncoffeeapp.util.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//from  w  w  w .ja va  2  s  . co m
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (PlatformUtils.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.yanghe.sujiu.network.image.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//w  w  w.  j  a  v a2s  .  c o m
 * @return The external cache dir
 */
@TargetApi(8)
public static File getExternalCacheDir(Context context) {
    File file = null;
    if (Utils.hasFroyo()) {
        file = context.getExternalCacheDir();
        if (null == file) {
            file = initPath(context);
        }
        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.android.fragmentbase.cache.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use/* w  w  w .j a  va  2s  . c  o  m*/
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (ImageUtils.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:wb.android.cache.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//from w  ww. j  ava2  s.  c o m
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (Utils.ApiHelper.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.slack.slackteam.cache.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use/*from  w  w  w  .j ava2s  .  c o  m*/
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (SLUtils.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.ccz.viewimages.displayingbitmaps.util.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//from   w w w . jav a  2 s  .  c om
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (FlavorUtils.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.chasebank.bitmap.util.ImageCache.java

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

    // 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.itsherpa.andg.imageloader.ImageCache.java

/**
 * Get the external app cache directory.
 * /*from  ww w.j  a  va2s  . c o  m*/
 * @param context
 *            The context to use
 * @return The external cache dir
 */
@TargetApi(8)
public static File getExternalCacheDir(Context context) {
    if (Utils.hasFroyo()) {
        File file = context.getExternalCacheDir();
        if (file == null) {
            // error on Sky with sdcard is not mounted
            return context.getDir("cache", Context.MODE_PRIVATE);
        }
        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.yooiistudios.newskit.core.cache.volley.ImageCache.java

/**
 * Get the external app cache directory.
 *
 * @param context The context to use//from  w w  w .  j a  v  a  2s. c o  m
 * @return The external cache dir
 */
@TargetApi(VERSION_CODES.FROYO)
public static File getExternalCacheDir(Context context) {
    if (Device.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:cn.com.wo.bitmap.ImageCache.java

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

    // 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);
}