Back to project page PhotoPicker.
The source code is released under:
GNU General Public License
If you think the Android project PhotoPicker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.thuytrinh.photopicker.controller.loader; /*from w w w . j a v a2 s .com*/ import android.content.Context; import android.content.CursorLoader; import android.database.Cursor; import android.provider.MediaStore; import com.thuytrinh.photopicker.controller.GroupByBucketIdFunc; import javax.inject.Inject; public class AlbumsLoader extends CursorLoader { @Inject public AlbumsLoader(Context context) { super(context); setUri(MediaStore.Images.Media.EXTERNAL_CONTENT_URI); setProjection(new String[] { MediaStore.Images.Media._ID, MediaStore.Images.Media.BUCKET_ID, MediaStore.Images.Media.BUCKET_DISPLAY_NAME, MediaStore.Images.Media.DATA }); } @Override public Cursor loadInBackground() { Cursor imageCursor = super.loadInBackground(); if (imageCursor != null && imageCursor.getCount() > 0) { Cursor bucketCursor = new GroupByBucketIdFunc().call(imageCursor); imageCursor.close(); return bucketCursor; } else { return imageCursor; } } }