Android SDCard Root Get getExternalCacheDir(Context context)

Here you can find the source of getExternalCacheDir(Context context)

Description

get External Cache Dir

License

Apache License

Declaration

private static String getExternalCacheDir(Context context) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import android.content.Context;
import android.os.Build;
import android.os.Environment;

public class Main {
    private static String getExternalCacheDir(Context context) {
        if (hasExternalCacheDir()) {
            return context.getExternalCacheDir().getPath() + File.separator
                    + "gesture";
        }//ww w. j av  a2 s  .  c  om

        final String cacheDir = "/Android/data/" + context.getPackageName()
                + "/cache/gesture/";
        return Environment.getExternalStorageDirectory().getPath()
                + cacheDir;
    }

    private static boolean hasExternalCacheDir() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO;
    }
}

Related

  1. getRootFilePath()
  2. getSDCardRoot()
  3. getOutputMediaFile()
  4. getOutputMediaFile(int type)