Search code examples
androidphotos

android: how to add an image to an album


Can anyone share code (or point me to Android sample code) to help me add images to an album in the Media Store (Gallery).

In my app I download images from our server, and also take new images using the camera (via Intent).

I would like to organize those images in an app-specific album, similar to what the Facebook (and other apps) app does, keeping related images all neatly organized.

I looked into this a while ago, following the Media Store API docs, and it didn't work for me....so need some help.

Thanks


Solution

  • you can use:

      MediaStore.Images.Media.insertImage(ContentResolver cr, Bitmap source, String title, String description);
    

    and I'm sure that somewhere here http://developer.android.com/guide/ in some of the sub-menus shows a command asking the MediaStore to scan a determined folder, I just can't find it now.

    edit: found it:

     MediaScannerConnection.scanFile(Context context, String[] path, null, null);