List all camera images in Android

The Gallery app obtains camera images by using a content resolver over Images.Media.EXTERNAL_CONTENT_URI and filtering the results by Media.BUCKET_ID. The bucket identifier is determined with the following code: public static final String CAMERA_IMAGE_BUCKET_NAME = Environment.getExternalStorageDirectory().toString() + “/DCIM/Camera”; public static final String CAMERA_IMAGE_BUCKET_ID = getBucketId(CAMERA_IMAGE_BUCKET_NAME); /** * Matches code in MediaProvider.computeBucketValues. Should be a common * … Read more

Get list of photo galleries on Android

Groupings are defined by MediaStore.Images.Media.BUCKET_DISPLAY_NAME. Here is the sample code to list the images and log their bucket name and date_taken: // which image properties are we querying String[] projection = new String[] { MediaStore.Images.Media._ID, MediaStore.Images.Media.BUCKET_DISPLAY_NAME, MediaStore.Images.Media.DATE_TAKEN }; // content:// style URI for the “primary” external storage volume Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; // Make the … Read more

How can I refresh MediaStore on Android?

Here is an easy to use ‘single file based‘ solution: Adding a file: Whenever you add a file, inform MediaStore‘s Content Provider using: sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(newMediaFile))); Deleting a file: Similarly, when you delete a file, inform MediaStore‘s Content Provider using: getContentResolver().delete(uri, null, null) // (Credit goes to [DDSports][1])