5

I am developing an app which hides images. I am able to delete images but gallery won't refresh itself & displays the thumbnail of an image which is hidden by my app. I am using

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

this code & it works upto an extent. But the main thing is that it first unmount & remount the SDCard which is time + resource consuming. Is there any another way which can instantly refresh the gallery without remounting the sdcard. One more thing I have also tried this code.

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

And it is also not satisfying.

4
  • Do you want to hide them (i.e. put a .nomedia file in the folder) or you want to delete them (gone forever)?
    – zapl
    Commented Sep 25, 2012 at 17:33
  • I have also same problem, if any one get the solution, please help Commented Jan 3, 2013 at 11:20
  • have you found any solution fr this ? Commented Jun 10, 2015 at 7:08
  • dd you find any solution? Commented Feb 27, 2017 at 12:03

0