保存到SD卡的Android图片未显示在图库中

时间:2011-07-13 03:40:03

标签: android android-camera android-sdcard

目前我有一个程序可以拍摄照片并将其作为jpg保存在SD卡的顶层,但它没有出现在Gallery中。我必须做些什么来实现它?

3 个答案:

答案 0 :(得分:11)

您需要call the MediaScanner以便它知道您的文件存在:

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

答案 1 :(得分:1)

试试这个答案。为我工作

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

答案 2 :(得分:0)

也许有人在“监督”它......

看看:
https://stackoverflow.com/a/5110571/371749

相关问题