Camera intent/Activity - avoid saving to gallery

前端 未结 3 1037
眼角桃花
眼角桃花 2021-02-07 17:23

I am using the Camera Activity to capture the picture. I call it with the MediaStore.EXTRA_OUTPUT extra parameter. The image is correctly saved

相关标签:
3条回答
  • 2021-02-07 17:41

    How about saving your images with non-image extension ? Something like michael.photo instead of michael.jpg/png etc.That way Gallery app wont take them in and I have seen many such apps keepsafe for example does this.

    0 讨论(0)
  • 2021-02-07 17:42

    I don't believe you can avoid this. The gallery application looks through your SD card for images and displays them automatically.

    0 讨论(0)
  • 2021-02-07 17:50

    Just replace your code

    File file = new File(Environment.getExternalStorageDirectory(), "Test.jpg" );
    

    with following code

    File file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "Test.jpg");
    

    Description of getExternalFilesDir() : Returns the absolute path to the directory on the primary external filesystem (that is somewhere on Environment.getExternalStorageDirectory()) where the application can place persistent files it owns. These files are internal to the applications, and not typically visible to the user as media.

    0 讨论(0)
提交回复
热议问题