哪里是在4.4.2我的SD卡的位置?我的、是在、位置、SD

由网友(ㄨ谈丆拢⒐搞)分享简介:在Android上4.4.2 Environment.getExternalStorageDirectory()。getPath()返回 /存储/模拟/ 0 但是这条道路并不在我的Nexus5的Andr​​oid 4.4.2存在。 Environment.getExternalStorageDirectory()。...

在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 /下载。而且下载成功。

我的手机SD卡有4个G,我把首选存储位置设为SD卡,现在明明还剩3个G多但是手机总是显示内存不足,

如果您正在寻找 /存储/模拟/ 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.

阅读全文

相关推荐

最新文章