Java tutorial
//package com.java2s; import java.io.File; import android.content.Context; import android.os.Build; import android.os.Environment; public class Main { private static File getExternalCacheDir(Context context) { if (hasExternalCacheDir()) { return context.getExternalCacheDir(); } final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); } private static boolean hasExternalCacheDir() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO; } }