Stop images on sd card from showing up in gallery?

后端 未结 8 755
借酒劲吻你
借酒劲吻你 2020-12-28 19:35

I keep some png files on the user\'s sd card. Some users report that these images are showing up in their gallery application. Sounds like the gallery implementation on some

8条回答
  •  猫巷女王i
    2020-12-28 20:06

    You can hide individual files from the gallery with a . prefix. For example .myimage.png

    I'm not sure what version dependencies the above has and it doesn`t work with some third-party picture tools like the Gallery.

    You should add a file named .nomedia into the directory where your images are. You may need to eject and re-insert the SD card before the images disappear from gallery (or otherwise trigger the media scanner) after creating this file on a phone that the Gallery has already picked up the files in the Gallery.

    I think the .nomedia option is the best solution, although again, third party tools may not respect the .nomedia flag.

提交回复
热议问题