Java tutorial
//package com.java2s; import android.os.Environment; import java.io.File; public class Main { public static File getDataRoot() { try { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) || (Environment.getExternalStorageDirectory().exists() && Environment.getExternalStorageDirectory().canWrite())) { return Environment.getExternalStorageDirectory(); } else { return Environment.getDataDirectory(); } } catch (Exception e) { return null; } } }