public static boolean isSDCardWritable ( ) { boolean mExternalStorageWriteable = false ; String state = Environment . getExternalStorageState ( ) ; if ( Environment . MEDIA_MOUNTED . equals ( state ) ) { // We can read and write the media mExternalStorageWriteable = true ; } else if ( Environment . MEDIA_MOUNTED_READ_ONLY . equals ( state ) ) { // We can only read the media mExternalStorageWriteable = false ; } else { // Something else is wrong. It may be one of many other states, // but all we need // to know is we can neither read nor write mExternalStorageWriteable = false ; } return mExternalStorageWriteable ; }
Check if the SD Card is writable