Java tutorial
//package com.java2s; import android.os.Environment; public class Main { private static final String DATA_SDCARD_ROOT = "/data/sdcard"; private static final String LEAF_MIUI_FILE_PATH = "/MIUI"; public static String getValidMIUIFilePath() { return hasMainSDCard() ? getMainSDCardRoot() + LEAF_MIUI_FILE_PATH : getDataSDCardRoot() + LEAF_MIUI_FILE_PATH; } public static boolean hasMainSDCard() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // boolean writable = checkFsWritable(); // return writable; return true; } return false; } public static String getMainSDCardRoot() { return Environment.getExternalStorageDirectory().getPath(); } public static String getDataSDCardRoot() { return DATA_SDCARD_ROOT; } }