Create a custom album in the Android Gallery app

I want to create a new album on Android. I did not understand that you need to do this with your own ContentProvider. But I can’t figure out how to do this. If you take pictures, all the images appear in the Camera album. If you installed Google+, you’ll see two more additional albums: Instant Download and Profile Image.

We want to create something like that. We have an album for the user online, and we want it to appear as an element of the album in the Gallery application. Can someone point me in the right direction.

I already checked: http://developer.android.com/guide/topics/providers/content-providers.html

Actually, I'm not sure if this is possible.

+5
source share
1 answer

You can use this method to create an album in the Gallery application. This name appears as "application images."

String path = Environment.getExternalStorageDirectory().toString();
File dir = new File(path, "/appname/media/app images/");
if (!dir.isDirectory()) {
        dir.mkdirs();
}

File file = new File(dir, filename + ".jpg");
String imagePath =  file.getAbsolutePath();
    //scan the image so show up in album
MediaScannerConnection.scanFile(this,
        new String[] { imagePath }, null,
        new MediaScannerConnection.OnScanCompletedListener() {
        public void onScanCompleted(String path, Uri uri) {
        if(Config.LOG_DEBUG_ENABLED) {
            Log.d(Config.LOGTAG, "scanned : " + path);
        }
        }
});
+7
source

All Articles