private static final String MOUNTS_FILE = "/proc/mounts";
public static boolean isMounted(String path) {
boolean blnRet = false;
String strLine = null;
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(MOUNTS_FILE));
while ((strLine = reader.readLine()) != null) {
if (strLine.contains(path)) {
blnRet = true;
break;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
reader = null;
}
}
return blnRet;
}
android系统根目录下有/proc/mounts文件,里面有所有挂载信息,用以上方法应该可以判断某个路径是否挂载