/**
* 获取内置SD卡路径
* @return
*/
public String getInnerSDCardPath() {
return Environment.getExternalStorageDirectory().getPath();
}
/**
* 获取外置SD卡路径
* @return 返回的集合 要么只有一条记录 要么为空
*/
public List<String> getExtSDCardPath()
{
List<String> lResult = new ArrayList<String>();
try {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("mount");
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
if (line.contains("extSdCard"))
{
String [] arr = line.split(" ");
String path = arr[1];
File file = new File(path);
if (file.isDirectory())
{
lResult.add(path);
}
}
}
isr.close();
} catch (Exception e) {
}
return lResult;
}
三星手机获取SD卡路径
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 内部存储路径/data/data/youPackageName/,在程序安装的时候创建,在卸载的时候被删除。 1....
- 影片已经观看数日,因为自己对惊悚悬疑片涉猎很少,加之写关于此类剧的东西容易剧透,我迟迟没有下笔。但脑海里始终会回旋...