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
  • 8,084
  • 3
  • 28
  • 34
Maurice
  • 6,413
  • 13
  • 51
  • 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
  • 8,084
  • 3
  • 28
  • 34
2

Try this answer. Working for me

context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(finalFile)));
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159
0

Maybe someone is "overseeing" it...

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

Community
  • 1
  • 1
cV2
  • 5,229
  • 3
  • 43
  • 53