I am creating a music player type app in Android.
So that i need to find all the mp3 files available in the phone,and display in a ListView.
So that i want to access external memory card of device.
I tries this,
Environment.getExternalStorageDirectory().getPath()
But this code points to internal sd card of device not external memory card.
So how can i access external memory card of device programmatically ?
Thanks in advance
First you can get a directory path like this ..
File storageDir = new File("/mnt/");
if (storageDir.isDirectory()) {
String[] dirList = storageDir.list();
//check here
}
Or
// Internal Storage
new File("/mnt/external_sd/")
// External Storage
new File("/mnt/extSdCard/")
In some phones internal and external refer to the same location
Try using this
if (android.os.Environment.getExternalStorageState().equals(
android.os.Environment.MEDIA_MOUNTED)) {
//use Environment.getExternalStorageDirectory() here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.