Skip to content

Instantly share code, notes, and snippets.

@xalexchen
Created November 13, 2013 06:04
Show Gist options
  • Save xalexchen/7444463 to your computer and use it in GitHub Desktop.
Save xalexchen/7444463 to your computer and use it in GitHub Desktop.
Checks if external storage is available for read and write
/* Checks if external storage is available for read and write */public boolean isExternalStorageWritable() {    String state = Environment.getExternalStorageState();    if (Environment.MEDIA_MOUNTED.equals(state)) {        return true;    }    return false;}/* Checks if external storage is available to at least read */public boolean isExternalStorageReadable() {    String state = Environment.getExternalStorageState();    if (Environment.MEDIA_MOUNTED.equals(state) ||        Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {        return true;    }    return false;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment