Android:.nomedia 被忽略,图像仍然出现在图库中
我正在构建一个应用程序,它从网络下载图像并将它们存储到我的 SDCard 中,为了使它们在图库中不可见,我使用此行生成 .nomedia 文件:
FileWriter f = new FileWriter("/sdcard/Android/data/CopyImage/cache/.nomedia");
应用程序可以成功下载图像并将 .nomedia 文件生成为 .nomedia 文件。 nodata 文件位于同一文件夹中,但问题是,图像仍然出现在图库中。
怎么可能呢? 有人能为我提供解决方案吗?
非常感谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
添加一个“。”改为文件夹名称的开头。
顺便说一句,哪部手机给你带来了这个问题。我的猜测是您在图库中看到旧的缓存文件
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
.nomedia 文件必须是文件夹中的第一个文件才能忽略其中的媒体。如果文件已建立索引,只需前后重命名此类文件夹(在中间打开图库)即可。
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.
创建“.nomedia”文件后,您必须重新启动手机,然后该文件夹的图像将不会出现在图库中。
After you created the ".nomedia" file, you must reboot you phone and then the images of the folder will not appear on the gallery.