Android: .nomedia is ignored, images still appear on the gallery

风流意气都作罢 提交于 2019-12-08 15:45:33

问题


I'm building an application which download images from the web and store them into my SDCard, in order to make them invisible in the gallery I put this line to generate a .nomedia file:

FileWriter f = new FileWriter("/sdcard/Android/data/CopyImage/cache/.nomedia");

the application can successfully download the image and make the .nodata file on the same folder, but the thing is, the image is still appear on the gallery.

How could that be? Can anybody provide me a solution?

Thank you very much


回答1:


Add a "." to the beginning of folder name instead.

BTW which phone is giving u this issue. My guess is that ur seeing old cached files in the Gallery




回答2:


The .nomedia file has to be the first file in a folder in order to ignore media there. If files are already indexed, just rename such folders forth and back (opening the Gallery in the middle) and there you go.




回答3:


After you created the ".nomedia" file, you must reboot you phone and then the images of the folder will not appear on the gallery.



来源:https://stackoverflow.com/questions/5895992/android-nomedia-is-ignored-images-still-appear-on-the-gallery

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