Java tutorial
//package com.java2s; import android.content.Context; import android.os.Environment; import java.io.File; import java.io.IOException; public class Main { private static File getExternalCacheDir(Context context) { File dataDir = new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"); File appCacheDir = new File(new File(dataDir, context.getPackageName()), "cache"); if (!appCacheDir.exists()) { if (!appCacheDir.mkdirs()) { //L.w("Unable to create external cache directory"); return null; } try { new File(appCacheDir, ".nomedia").createNewFile(); } catch (IOException e) { //L.i("Can't create \".nomedia\" file in application external cache directory"); return null; } } return appCacheDir; } }