Java tutorial
//package com.java2s; import android.os.Environment; import java.io.File; public class Main { private static final String ROOT_DIR = "WmiCache"; private static String getSDDir(String key_dir) { StringBuilder sb = new StringBuilder(); String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath();// /mnt/sdcard sb.append(absolutePath); sb.append(File.separator).append(ROOT_DIR).append(File.separator).append(key_dir); String filePath = sb.toString(); File file = new File(filePath); if (!file.exists()) { if (file.mkdirs()) { return file.getAbsolutePath(); } else { return ""; } } return file.getAbsolutePath(); } }