简体   繁体   English

如何在Android 6上获得模拟的存储路径?

[英]How to get emulated storage path on Android 6?

I want to get the emulated storage path. 我想获得模拟的存储路径。 System.getenv("EMULATED_STORAGE_TARGET") works on previous versions ie Android 5 and below but returns null on Android 6. I searched on google but couldn't find anything. System.getenv("EMULATED_STORAGE_TARGET")System.getenv("EMULATED_STORAGE_TARGET")版本(即Android 5及更低版本System.getenv("EMULATED_STORAGE_TARGET")有效,但在Android 6上返回null。我在google上搜索但找不到任何内容。 How can I get the emulated storage path on Android 6. Any help will be appreciated. 如何在Android 6上获得模拟的存储路径。我们将不胜感激。 Thanks in advance!! 提前致谢!!

You appear to be referring to external storage , which on some versions of Android will be located at /storage/emulated/0/ . 您似乎是在指外部存储 ,在某些版本的Android上,该外部存储位于/storage/emulated/0/ The proper way to obtain the root of external storage, on all versions of Android, is by means of Environment.getExternalStorageDirectory() . 所有版本的Android上,获取外部存储根目录的正确方法是通过Environment.getExternalStorageDirectory()

If you find yourself using environment variables in an Android app, you are doing it wrong. 如果发现自己在Android应用程序中使用环境变量,则说明您做错了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何进入存储/模拟/0 - How to get to storage/emulated/0 如何获取 Android 10 及更高版本的路径 /storage/emulated/0/Download/file_name.mime_type - How to get path /storage/emulated/0/Download/file_name.mime_type for Android 10 and above Android设备上的file:/// storage / emulated / 0路径 - file:///storage/emulated/0 path on android device 如何在android中创建外部存储目录,将外部存储路径显示为“storage / emulated / 0”? - How to create directory in external storage in android which show external storage path as “storage/emulated/0”? 如何使用存储访问框架访问“/storage/emulated/0/Android/media/”? - How to get access to "/storage/emulated/0/Android/media/" using Storage Access Framework? 模拟外部存储android - emulated external storage android FileNotFoundException:/ storage / emulated / 0 / Android - FileNotFoundException: /storage/emulated/0/Android FileSystemException:无法打开文件,路径 = '目录:'/storage/emulated/0/Android/data/ - FileSystemException: Cannot open file, path = 'Directory: '/storage/emulated/0/Android/data/ android 11中/storage/emulated/路径下的read.txt字段数据 - Read .txt field data from /storage/emulated/ path in android 11 无法播放路径中的视频 (/storage/emulated/0/Android/data/com...) - Could not play video in the path (/storage/emulated/0/Android/data/com…)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM