When deleting the images on Android’s SD Card, sometimes the images are correctly removed but in the gallery still remains a preview of the removed image. When tapping on it, it is loaded as a black image. To resolve it I need to run MediaScanner
. But this code doesn't work and still, the preview of review image remains in the Gallery.
Anyone knows how to resolve this.
Uri contentUri = Uri.fromFile(file);
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,contentUri);
sendBroadcast(mediaScanIntent);
Try going to Settings>SD card & phone storage>Unmount Sd card>Mount SD card. That should trigger the media scanner, and your gallery should refresh.
Internal storage with dcim camera map doesn't contain any images. Therefore the only option which remains is to delete images from the picture map which automatically deletes all images saved on sd as well. Actually the device stores images on both storages and deletes from both.
Go to “Settings” > “Accounts” > “Google“. From there, you can select the Google account you are using, then uncheck the “Sync Picasa Web Albums” option. Now under “Settings” > “Application manager“, swipe over to “All” > “Gallery“, and select “Clear data“.
Restart Your Device This is a very simple step but believe it or not, in case you can't delete photos from your Android gallery, after a simple restart, you might just be able to. Restarting the phone helps get rid of temporary files and app cache that can often interfere with the operations of your Android smartphone.
For each file while deleted use this
KITKAT
this worked for me
try {
context.getContentResolver().delete(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
MediaStore.Images.Media.DATA + "='"
+ new File(fileUri).getPath() + "'", null);
} catch (Exception e) {
e.printStackTrace();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With