大佬教程收集整理的这篇文章主要介绍了获取Android 4.3中的外部存储列表,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
所以在Android 4.3中,我该怎么做才能获得外部存储列表?
我的代码看起来像这样.现在它包括不可移动的内部和可移动外部存储.
File voldFile = new File("/system/etc/vold.fstab"); fr = new FileReader(voldFilE); br = new BufferedReader(fr); String line = br.readLine(); while (line != null) { if (line.startsWith("dev_mount")) { String[] tokens = line.split("\\s"); File mountPoint = new File(tokens[2]); if (mountPoint.isDirectory() && mountPoint.canRead()) list.add(tokens[2]); } line = br.readLine(); }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODEs.jeLLY_BEAN_MR2) { File voldFile = new File("/proc/mounts"); fr = new FileReader(voldFilE); br = new BufferedReader(fr); String line = br.readLine(); while (line != null) { Log.d(tag,linE); if (line.startsWith("/")) { String[] tokens = line.split("\\s+"); if ("vfat".equals(tokens[2])) { File mountPoint = new File(tokens[1]); if (!tokens[1].equals(defaultMount)) if (mountPoint.isDirectory() && mountPoint.canRead()) list.add(tokens[1]); } } line = br.readLine(); } }
以上是大佬教程为你收集整理的获取Android 4.3中的外部存储列表全部内容,希望文章能够帮你解决获取Android 4.3中的外部存储列表所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。