开发者

android create photo album

do you know how to create a folder in which photos will be saved and os and other apps should开发者_如何学运维 see that folder as photo album? I need to save photos in a certain album and if album does not exists, I need to create it.

Thanks


If you store images files anywhere on the external storage (with the exception of locations that also contain a .nomedia file), the media scanner, and thus the built-in "Gallery" app, will locate them and display them.

To be a good citizen you should place such files in the recommended location on the external storage using getExternalStoragePublicDirectory. You can pass that DIRECTORY_PICTURES for images.

Be advised though, that stuff is only available as of API level 8. If you need to also support earlier API versions you can use getExternalStorageDirectory and still use the correct recommended path on your own.

And, as always, you need to make sure the external storage is available before you try to write to it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜