Update Android Gallery

我怕爱的太早我们不能终老 提交于 2019-12-13 20:33:46

问题


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.

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

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


回答1:


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

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



来源:https://stackoverflow.com/questions/17156746/update-android-gallery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!