哪里是在4.4.2我的SD卡的位置? [英] Where is my sdcard location on 4.4.2?

查看:170
本文介绍了哪里是在4.4.2我的SD卡的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android上4.4.2 Environment.getExternalStorageDirectory()。getPath()返回 /存储/模拟/ 0 但是这条道路并不在我的Nexus5的Andr​​oid 4.4.2存在。 Environment.getExternalStorageDirectory()。getPath()工作,直到安卓4.4.2。

我怎样才能在Android 4.4.2 / SD卡路径?

解决方案
  

这个路径不会在我的Nexus5的Andr​​oid 4.4.2存在。

是的,确实如此,对于你的进程在运行。

例如,此示例项目下载文件到 Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)。如果你在运行日志的位置,在一台Nexus 5上运行时,它被报告为 /存储/模拟/ 0 /下载。而且下载成功。

如果您正在寻找 /存储/模拟/ 0 通过DDMS或 亚行外壳 ,你不会找到它。对于这些工具,默认的外部存储的/ mnt /壳/模拟/ 0 。因此,从上面的示例下载的文件出现在的/ mnt /壳/模拟/ 0 /下载目录。

AFAIK,所不同的是依赖于提供独立的外部存储到二级帐户。

On Android 4.4.2 Environment.getExternalStorageDirectory().getPath() returns /storage/emulated/0 but this path does not exist on my Nexus5 Android 4.4.2. Environment.getExternalStorageDirectory().getPath() worked up until Android 4.4.2.

How can I get the /sdcard path on Android 4.4.2?

解决方案

This path does not exist on my Nexus5 Android 4.4.2.

Yes, it does, for your process at runtime.

For example, this sample project downloads a file to Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS). If you log the location at runtime, when running it on a Nexus 5, it is reported as /storage/emulated/0/Download. And the download succeeds.

If you are looking for /storage/emulated/0 via DDMS or adb shell, you will not find it. For those tools, default external storage is /mnt/shell/emulated/0. Hence, the downloaded file from the above sample appears in the /mnt/shell/emulated/0/Download directory.

AFAIK, the difference is tied to providing separate external storage to secondary accounts.

这篇关于哪里是在4.4.2我的SD卡的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆