I have added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to Manifest but I still get “SDcard mounted RO” when executing the below code. What am I doing wrong here?
if(!extState.equals(Environment.MEDIA_MOUNTED)) {
Log.d(Tag.getTag(this),
("SDcard not mounted"));
}
else if (!extState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
Log.d(Tag.getTag(this),
("SDcard mounted RO"));
}
else {
Log.d(Tag.getTag(this),
("SDcard mounted RW"));
}
Your code logic seems to be wrong?
“Not equal to MEDIA_MOUNTED” could be “mounted_ro” or “not mounted”…
Anyway, you should change to …