Java tutorial
//package com.java2s; import java.io.File; import android.os.Environment; public class Main { private static final String ROOT_DIR = "reder"; /** * Get the external storage path of the device * * @return The external storage path of the device. */ public static String getAppRootDirectory() { try { if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return null; } } catch (Exception e) { // Catch exception is trying to fix a crash inside of Environment.getExternalStorageState(). e.printStackTrace(); return null; } String rootDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + ROOT_DIR + "/"; File file = new File(rootDir); if (!file.exists()) { if (!file.mkdirs()) { return null; } } return rootDir; } }