I’m stuck so I hope someone can help 🙂 I have an activity where I can load the image from gallery and then it shows on the screen. On that screen I have an option to delete that image. When I choose the option to delete the image, image is successfully deleted but it still shows in the gallery when I choose to load another image. So, user can still select old picture from gallery but in this case it doesn’t show up on screen because it’s deleted. How to refresh the gallery after the picture is deleted?
I’ve tried this but it seems it doesn’t work:
sendBroadcast(new Intent(
Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));
I want to avoid scanning SD card manually every time when I delete some image.
The problem was that i was passing image URI instead of absolute path when deleting so it was unsuccessful. The code should look like this.
So, that method works but file was not deleted at all so it was still in the gallery.