/** Method to check whether external media available and writable
and to find the
root of the external file system. */
private void checkExternalMedia () {
// Check external media availability. This is adapted from
//
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Can't read or write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
// Find the root of the external storage and output external
storage info to screen
root = android.os.Environment.getExternalStorageDirectory();
tv.append( "External storage:
Exists="+mExternalStorageAvailable+", Writable="
+mExternalStorageWriteable+" Root="+root+"\n");
}
/
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en