Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.os.Environment; import android.util.Log; import java.io.File; public class Main { public static File getSkinDir(Context context) { File skinDir = new File(getCacheDir(context), "skin"); if (skinDir.exists()) { skinDir.mkdirs(); } return skinDir; } public static File getCacheDir(Context context) { Log.i("getCacheDir", "cache sdcard state: " + Environment.getExternalStorageState()); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File cacheDir = context.getExternalCacheDir(); if (cacheDir != null && (cacheDir.exists() || cacheDir.mkdirs())) { Log.i("getCacheDir", "cache dir: " + cacheDir.getAbsolutePath()); return cacheDir; } } File cacheDir = context.getCacheDir(); Log.i("getCacheDir", "cache dir: " + cacheDir.getAbsolutePath()); return cacheDir; } }