问题描述
版本的Android 4.3,API 18日的Nexus 4
Android ver 4.3, API 18, Nexus 4
我想保存在指定的位置有些录制的视频文件。我使用的:
I am trying to save some recorded video files in a specified location. I am using:
File mediaStorage = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "DirName");
这工作得很好,但是当我尝试使用DIRECTORY_PICTURES位置,而不是作为Android开发者文档建议(的),它不存在。
This works fine, but when I try to use the DIRECTORY_PICTURES location instead, as the android developer docs recommend (http://developer.android.com/guide/topics/media/camera.html#saving-media), it doesn't exist.
任何人都知道为什么吗?
Anyone know why?
推荐答案
图片和DCIM是两个独立的目录。首先是位于SD卡:/图片,第二个是在SD卡:/ DCIM。
我建议你记录保存到SD卡:/图片/ YOURAPPNAME /(使用mkdirs()创建此目录)
并添加到您的清单:
Pictures and DCIM are two separate directory. the first is located at sdcard:/Picture , the second is at sdcard:/DCIM.I suggest to save your record to sdcard:/Picture/YOURAPPNAME/ (use mkdirs() to create this directory)and add this to your manifest :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
记得致电媒体扫描仪会在您保存文件后,因此它可以在画廊中显示。
希望这有助于
Remember to call the media scanner after you have saved your file, so it can be displayed on the gallery.Hope this helps
这篇关于安卓environment.directory_pictures无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!