Pregunta

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

¿Fue útil?

Solución

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

Otros consejos

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)));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top