public static void getSDCardPathEx(List<String> pathList) {
if (pathList == null) {
return;
}
// String mount = new String();
try {
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("mount");
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
String line;
BufferedReader br = new BufferedReader(isr);
while ((line = br.readLine()) != null) {
if (line.contains("secure"))
continue;
if (line.contains("asec"))
continue;
if (line.contains("fat")) {
String columns[] = line.split(" ");
if (columns != null && columns.length > 1) {
// mount = mount.concat("*" + columns[1] + "\n");
Log.e("PATH", columns[1]);
pathList.add(columns[1]);
}
} else if (line.contains("fuse")) {
String columns[] = line.split(" ");
if (columns != null && columns.length > 1) {
// mount = mount.concat(columns[1] + "\n");
Log.e("PATH", columns[1]);
pathList.add(columns[1]);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//return mount;
}
android 获取加载的SD卡路径
最新推荐文章于 2021-06-03 10:05:36 发布