6

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

Hariharan
  • 24,741
  • 6
  • 50
  • 54
Sandeep Patidar
  • 287
  • 1
  • 2
  • 6

3 Answers3

1

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

sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(yourFile)));
shem
  • 4,686
  • 2
  • 32
  • 43
0

You have to tell the device to scan the new media file. Try with this snippet:

MediaScannerConnection.scanFile(
        this, new String[]{file.getAbsolutePath()}, null, null);
Alessandro Roaro
  • 4,665
  • 6
  • 29
  • 48
0

I think you'd better make a folder in the camera default folder and put your data in it. Check if a file with the name of ".nomedia" is not in that folder.