更新Android图库 [英] Update Android Gallery

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

问题描述

我正在开发一个Android应用程序,它读取外部存储的图像进行图像处理,将创建外部STORGE图片的新文件夹,在其中存储经过处理的图像。

I am developing an Android app which reads images from external storage for image processing, creates a new folder in "pictures" on external storge and stores the processed images in it.

它采用标准的Andr​​oid画廊很长一段时间,甚至重新启动才能识别新的文件夹中。

It takes the standard android gallery a long time or even a reboot to recognize the new folder.

有没有一种方法来更新编程,所以我的新文件夹会从画廊认可的Andr​​oid图库?

Is there a way to update android gallery programmatically so my new folder gets recognized from gallery?

推荐答案

触发的mediascanner再次读取所有的媒体文件。用这块code的:

Trigger the mediascanner to read all the media files again. Use this piece of code :

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

这是非常低效的,虽然,因为它会首先读取整个SD卡更改。

This is very inefficient though since it'll begin reading the entire SDCard for changes.

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

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