安卓4.2 - Environment.getExternalStorageDirectory()getPath()行为 [英] Android 4.2 - Environment.getExternalStorageDirectory().getPath() behaviour
问题描述
我一直在开发一个Android应用程序,最后更新之前到4.2,我用
I've been developing an android application, before the last update to 4.2, I used
Environment.getExternalStorageDirectory().getPath()
这回我/存储/ sdcard0 /,但由于更新我现在获得/存储/模拟/ 0。
which returned me /storage/sdcard0/, but since the update I now get /storage/emulated/0.
我一直在阅读有关在Android 4.2的多用户功能,我猜这就是0从何而来,不过,我还是不知道怎么去,我更新之前使用的路径。
I've been reading about the multiuser capabilities on Android 4.2 and I'm guessing that's where the 0 comes from, however, I still don't know how to get to the path I was using before the update.
推荐答案
这是你的路径,所以只用它。不要考虑一下。路径改变,因为4.2由于多用户功能。安卓应与处理的固件升级,所以你不必理会。只要使用它,你至今也不用担心它改变。如果你的code某种程度上依赖于旧值,然后修复您的code。
This is your path, so just use it. Do not think it over. Paths changed since 4.2 due to multiuser feature. Android shall deal with that on firmware upgrade so you do not need to bother. Just use it as you did so far and do not worry it changed. If your code somehow depends on old value, then fix your code.
这篇关于安卓4.2 - Environment.getExternalStorageDirectory()getPath()行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!