Java tutorial
//package com.java2s; import android.os.Environment; public class Main { public static String getRootFilePath() { if (hasSDCard()) { return Environment.getExternalStorageDirectory().getAbsolutePath() + "/";// filePath:/sdcard/ } else { return Environment.getDataDirectory().getAbsolutePath() + "/data/"; // filePath: /data/data/ } } public static boolean hasSDCard() { String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) { return false; } return true; } }