【发布时间】:2011-05-31 04:39:51
【问题描述】:
可能重复:
How to capture an image and store it with the native Android Camera
如何将摄像头捕获的图像存储到 DCIM/Camera 文件夹中...默认情况下
【问题讨论】:
-
拜托,下次用搜索,这个问题很常见。
标签: android
可能重复:
How to capture an image and store it with the native Android Camera
如何将摄像头捕获的图像存储到 DCIM/Camera 文件夹中...默认情况下
【问题讨论】:
标签: android
您需要在 DCIM 文件夹中吗?我认为首选文件夹是图片。在这里,您可以找到有关如何使用共享文件夹的说明的链接: http://developer.android.com/guide/topics/data/data-storage.html
保存应该共享的文件
如果您要保存并非特定于您的应用程序且在卸载应用程序时不应删除的文件,请将它们保存到外部存储上的公共目录之一。这些目录位于外部存储的根目录,例如 Music/、Pictures/、Ringtones/ 等。
在 API 级别 8 或更高版本中,使用 getExternalStoragePublicDirectory(),将您想要的公共目录类型传递给它,例如 DIRECTORY_MUSIC、DIRECTORY_PICTURES、DIRECTORY_RINGTONES 或其他。如果需要,此方法将创建相应的目录。
如果您使用 API 级别 7 或更低,请使用 getExternalStorageDirectory() 打开代表外部存储根目录的文件,然后将共享文件保存在以下目录之一中:
Music/ - Media scanner classifies all media found here as user music.
Podcasts/ - Media scanner classifies all media found here as a podcast.
Ringtones/ - Media scanner classifies all media found here as a ringtone.
Alarms/ - Media scanner classifies all media found here as an alarm sound.
Notifications/ - Media scanner classifies all media found here as a notification sound.
Pictures/ - All photos (excluding those taken with the camera).
Movies/ - All movies (excluding those taken with the camcorder).
Download/ - Miscellaneous downloads.
【讨论】: