Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; import android.os.Environment; public class Main { public static boolean hasStorage(boolean requireWriteAccess) { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { if (requireWriteAccess) { boolean writable = checkFsWritable(); return writable; } else { return true; } } else if (!requireWriteAccess && Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { return true; } return false; } private static boolean checkFsWritable() { String directoryName = Environment.getExternalStorageDirectory().toString() + "/DCIM"; File directory = new File(directoryName); if (!directory.isDirectory()) { if (!directory.mkdirs()) { return false; } } File f = new File(directoryName, ".probe"); try { if (f.exists()) { f.delete(); } if (!f.createNewFile()) { return false; } f.delete(); return true; } catch (IOException ex) { return false; } } }