保存到SD卡Android的图片没有显示在库 [英] Android picture saved to SD card not showing in Gallery

查看:149
本文介绍了保存到SD卡Android的图片没有显示在库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我有一个程序,它的照片,并将其保存在SD卡的顶层JPG格式,但它没有出现在画廊。有什么是我必须做的做到这一点?

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?

推荐答案

您需要致电MediaScanner ,以便它知道你的文件存在:

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

这篇关于保存到SD卡Android的图片没有显示在库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆