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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

0 Answers0