I am developing an android application and I need to know how could i check if the sdcard exist or not before exporting a file to it , so that i could notify the user that the sdcard is or isn't mounted.
Asked
Active
Viewed 146 times
0
-
Are you talking about the removable SDCard ? – Chintan Soni Mar 02 '14 at 19:22
-
well jamoBox just answered me. – user30102967 Mar 02 '14 at 19:24
1 Answers
1
public boolean hasSDCard() {
return android.os.Environment.getExternalStorageState()
.equals(android.os.Environment.MEDIA_MOUNTED);
}

JamoBox
- 764
- 9
- 23
-
1Unfortunately, this is not universal, for example it returns true on my Nexus 4, which has NO SD card. See the docs for getExternalStorageState() here - http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory() – Melquiades Mar 02 '14 at 19:18