0

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

jbc25
  • 1,192
  • 2
  • 14
  • 20

2 Answers2

1

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

Community
  • 1
  • 1
nandeesh
  • 24,740
  • 6
  • 69
  • 79
  • It's curious, I tried the solution of this thread in a Samsung Galaxy S2 and a SE Xperia Arc S. In SE perfect but in Galaxy it didn't update media. Only worked with the intent and its corresponding toast :( – jbc25 Oct 21 '12 at 12:50
0

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)));
Couitchy
  • 1,079
  • 10
  • 15