Example usage for android.content Context getCacheDir

List of usage examples for android.content Context getCacheDir

Introduction

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

Prototype

public abstract File getCacheDir();

Source Link

Document

Returns the absolute path to the application specific cache directory on the filesystem.

Usage

From source file:Main.java

public static File getDetailPath(Context context) {
    return new File(context.getCacheDir().getAbsolutePath() + "/info", fileName);
}

From source file:Main.java

public static String getCachePath(Context context) {
    File f = context.getCacheDir();
    if (null == f) {
        return null;
    } else {//from  ww  w.  j a  v a 2s. c o m
        return f.getAbsolutePath() + "/";
    }
}

From source file:Main.java

private static String getImageCacheDir(Context context) {
    String dir = context.getCacheDir() + "cache" + File.separator;
    File file = new File(dir);
    if (!file.exists())
        file.mkdirs();/*from   ww  w  .  j  av a2 s .c o m*/
    return dir;
}

From source file:Main.java

public static String getDirectoty(Context context) {
    File file = new File(context.getCacheDir(), "image");
    return file.getAbsolutePath();
}

From source file:Main.java

public static String getTotalSkinPath(Context context) {
    String SKIN_PATH = context.getCacheDir().getAbsolutePath();
    String totalPath = SKIN_PATH + File.separator + SKIN_NAME;
    return totalPath;
}

From source file:Main.java

public static void clearCache(Context context) {

    File cache = context.getCacheDir();
    String[] files = cache.list();
    for (String file : files) {
        File data = new File(cache.getPath() + "/" + file);
        data.delete();//ww w .ja v a  2s .  c o  m
    }
}

From source file:Main.java

public static File getLetterCacheDir(Context context) {
    File cache = new File(context.getCacheDir() + "/letters/");
    cache.mkdirs();/* w  w  w  .  j a  v  a  2 s  .  com*/
    return cache;
}

From source file:Main.java

private static File descriptorFromCacheDirectory(Context ctx, String path) {
    File cacheRoot = ctx.getCacheDir();
    return new File(cacheRoot, path);
}

From source file:Main.java

public static void clearAllCache(Context context) {
    deleteDir(context.getCacheDir());
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        deleteDir(context.getExternalCacheDir());
    }/*ww w  .j  av a 2s  . c o  m*/
}

From source file:Main.java

public static File getInfoPath(Context context, String fileName) {
    return new File(context.getCacheDir().getAbsolutePath() + "/info", fileName);
}