How do I get multiple storage file paths on Android? -


in phone have 2 storages, 1 of them sd card , other extsdcard.

i can sdcard path by:

environment.getexternalstoragedirectory() .tostring() 

how extsdcard file path?

use other external sdcard:

 file storagedir=   new file("/mnt/external_sd/") 

or

 file storagedir=   new file("/mnt/extsdcard/") 

for more details see http://mono-for-android.1047100.n5.nabble.com/detect-sd-card-path-td5710218.html#a5710250 , this

so use function list of ext cards...

public static hashset<string> getexternalmounts() {     final hashset<string> out = new hashset<string>();     string reg = "(?i).*vold.*(vfat|ntfs|exfat|fat32|ext3|ext4).*rw.*";     string s = "";     try {         final process process = new processbuilder().command("mount")                 .redirecterrorstream(true).start();         process.waitfor();         final inputstream = process.getinputstream();         final byte[] buffer = new byte[1024];         while (is.read(buffer) != -1) {             s = s + new string(buffer);         }         is.close();     } catch (final exception e) {         e.printstacktrace();     }      // parse output     final string[] lines = s.split("\n");     (string line : lines) {         if (!line.tolowercase(locale.us).contains("asec")) {             if (line.matches(reg)) {                 string[] parts = line.split(" ");                 (string part : parts) {                     if (part.startswith("/"))                         if (!part.tolowercase(locale.us).contains("vold"))                             out.add(part);                 }             }         }     }     return out; } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -