Android examples for Hardware:Device Feature
get External Cache Directory
//package com.java2s; import android.content.Context; import android.os.Build; import android.os.Environment; public class Main { private static String getExternalCacheDir(Context context) { if (hasExternalCacheDir()) { //from ww w . java2s.co m } // Before Froyo we need to construct the external cache dir ourselves final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/image/"; return Environment.getExternalStorageDirectory().getPath() + cacheDir; } private static boolean hasExternalCacheDir() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO; } }