Search code examples
androidphotoalbumart

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


Solution

  • 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.