Maurice
Maurice

Reputation: 6433

Android picture saved to SD card not showing in Gallery

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?

Upvotes: 2

Views: 3901

Answers (3)

Ranjithkumar
Ranjithkumar

Reputation: 18356

Try this answer. Working for me

context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(finalFile)));

Upvotes: 2

cV2
cV2

Reputation: 5319

Maybe someone is "overseeing" it...

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

Upvotes: 0

jakebasile
jakebasile

Reputation: 8132

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);

Upvotes: 12

Related Questions