How to remove a thumbnail programmatically from the galley after deleting the image?

I am developing an application that hides images. I can delete images, but the gallery does not update itself and displays a thumbnail of an image that is hidden by my application. I use

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
        Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

this code, and it works to some extent. But the main thing is that he first unmounts and reboots SDCard, time + resource. Is there any other way that can instantly update the gallery without reinstalling the SD card. Another thing I also tried this code.

MediaScannerConnection.scanFile(
        getBaseContext(),
        new String[]{ src.toString() },
        null,
        new MediaScannerConnection.OnScanCompletedListener() {
            public void onScanCompleted(String path, Uri uri) {
            }
        );

And it also does not satisfy.

+5
source share

All Articles