How can i get extSdcard path in android?
There are 2 storage, first external storage in which all the phones have it but there is second storage which is called removable storage (micro sdcard).
I want to get the path to the micro sdcard in android, how is that possible?
Advertisement
Answer
Starting from KitKat, you have access to a method to get that directory :
Context.getExternalFilesDirs()
Note that it may return null if the SD card is not mounted or moved during the access. Also, you might need to add these permissions to your manifest file :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Apparently some users had trouble with this method, not returning the SD card path. I found some useful informations on how it can works and how it can not depending on the device on this post.