如何从Java或本机代码中枚举安装在Android手机上的所有SD卡?
答案 0 :(得分:0)
这不仅会列出已安装的sdcards,还会列出Android设备上所有已安装的文件系统。
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("cat /proc/mounts");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
// read the output from the command
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}