Stop images on sd card from showing up in gallery?

后端 未结 8 737
借酒劲吻你
借酒劲吻你 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条回答
  •  甜味超标
    2020-12-28 20:10

    While making external directory use something like this

    File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory("YourDirectoryName"),"YourFolderName");
    

    Instead of

    File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "YourFolderName");
    

    These files won't be detected by gallery for more reference check saving media files on this link

    http://developer.android.com/guide/topics/media/camera.html#intent-receive

提交回复
热议问题