Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image not show in gallery

I launch default camera using intent and store those camera images in external storage using below path:

File file = new File(Environment.getExternalStorageDirectory()
                   + File.separator + fileName);

But it does not show in gallery. The issue comes in nexus 4,7 and moto G devices with OS 4.4.2

I try with

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

But It not work

like image 493
Sandeep Patidar Avatar asked Apr 01 '14 08:04

Sandeep Patidar


1 Answers

You will have to refresh the media scanner cache, try this:

sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(yourFile)));
like image 105
shem Avatar answered Oct 20 '22 12:10

shem