将图片添加到图库 - Android电子 [英] Adding pictures to the Gallery - Android

查看:133
本文介绍了将图片添加到图库 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要用相机照片的活动,然后将其添加到适当的文件夹(在这种情况下/ DCIM /摄像机)。但是当你退出该应用程序并加载了Android画廊......它不存在。我是围绕做一些玩,发现它,只有当重新启动手机后会出现在那里。我不知道这背后的原因(也许它创建缩略图?)......有没有解决这个办法吗?我希望它显示出来的时候了。

I have an activity that takes a photo with the camera, and then adds it to its proper folder (in this case /DCIM/Camera). But then when you exit the app and load up the Android gallery...it's not there. I was doing some playing around and noticed it only appears there when after restarting the phone. I'm not sure the reason behind this (maybe it has to create the thumbnail?)...is there any way around this? I want it to show up right away.

谢谢!

推荐答案

您需要与新添加的照片的路径运行MediaScanner。将在库中显示即可。 API等级8拥有这款名为SCANFILE一个方便的功能。

You need to run the MediaScanner with the path of the newly added photo. Will show up in the library then. API Level 8 has a convenient function for this called scanFile.

在<一个细节href=\"http://developer.android.com/reference/android/media/MediaScannerConnection.html\">http://developer.android.com/reference/android/media/MediaScannerConnection.html

这篇关于将图片添加到图库 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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