Java tutorial
//package com.java2s; import android.os.Environment; public class Main { public static String getRootDir() { if (isHasSdcard()) { return Environment.getExternalStorageDirectory().getAbsolutePath() + "/YLTadm/"; } else { return Environment.getDataDirectory().getAbsolutePath() + "/"; } } private static boolean isHasSdcard() { String status = Environment.getExternalStorageState(); if (status.equals(Environment.MEDIA_MOUNTED)) { return true; } else { return false; } } }