简体   繁体   中英

How to get the external SDCard?

I want to get the external SDCard path. I use Environment.getExternalStorageDirectory() and get the internal sdcard /mnt/sdcard/ . My external sdcard is /storage/extSdCard .

How to get it programmatically?

Try like this.

For eg: File f= new File("/mnt/extSdCard/");

new File("/mnt/external_sd/")

or

new File("/mnt/extSdCard/")

in replace of Environment.getExternalStorageDirectory()

Hope it might help you.

File storageDir = new File("/mnt/");
if(storageDir.isDirectory()){
String[] dirlst = storageDir.list();
//TODO some type of selecton method

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM