Question

In my app, I have functions of taking photos and open gallery to watch them. When user take a photo, it updates media through:

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

But always appears saying something like "Media scan completed". I would like to remove this toast.

Thanks

Was it helpful?

Solution

Cancelling the toast shown by another process is not possible. You can follow this thread to force media scan without using broadcast

OTHER TIPS

You could use sendBroadcast but just for a specific file (in your case the one created after taking the photo). This way you won't get the toast.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(someFile)));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top