2

Currently I have a program that takes pictures and saves them as a jpg on the top level of the sdcard, but its not appearing in the Gallery. Is there something I must do to make it happen?

jakebasile
  • 7,884
  • 3
  • 27
  • 34
Maurice
  • 6,343
  • 13
  • 50
  • 76

3 Answers3

12

You need to call the MediaScanner so that it knows your file exists:

File file; // = your file
String mimetype; // = your file's mimetype. MimeTypeMap may be useful.
MediaScanner.scanFile(getApplicationContext(), new String[]{file.getPath()}, new String[]{mimetype}, null);
jakebasile
  • 7,884
  • 3
  • 27
  • 34
2

Try this answer. Working for me

context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(finalFile)));
Ranjithkumar
  • 14,780
  • 10
  • 107
  • 140
0

Maybe someone is "overseeing" it...

Take a look at:
https://stackoverflow.com/a/5110571/371749

Community
  • 1
  • 1
cV2
  • 5,676
  • 4
  • 43
  • 54