目前我有一个程序可以拍摄照片并将其作为jpg保存在SD卡的顶层,但它没有出现在Gallery中。我必须做些什么来实现它?
答案 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)
也许有人在“监督”它......