Android examples for android.os:SD Card
is Sd Card Writable
import android.content.ContextWrapper; import android.os.Environment; import java.io.File; public class Main{ public static boolean isSdCardWritable() { String lStorageState = Environment.getExternalStorageState(); boolean lIsSdcardWritable; boolean lIsSdCardAvailable; if (Environment.MEDIA_MOUNTED.equals(lStorageState)) { lIsSdCardAvailable = lIsSdcardWritable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY .equals(lStorageState)) { lIsSdCardAvailable = true;/*from w w w.j a v a 2 s . c o m*/ lIsSdcardWritable = false; } else { lIsSdCardAvailable = lIsSdcardWritable = false; } return lIsSdCardAvailable && lIsSdcardWritable; } }