unable to decode stream java.io.FileNotFoundException /storage/emulated/0 open failed:ENOENT(No such file or directory

后端 未结 5 583
慢半拍i
慢半拍i 2021-01-13 22:23

hello i\'m trying to save pictures taken on my application, but when i try to access the memory to place the data, an error comes out

unable to decode stream java.io

5条回答
  •  梦毁少年i
    2021-01-13 23:13

    First, you are writing the image to a different location than you are reading it from. Rather than rebuild path, use the tmpFile value that you already have.

    Second, do not use getRootDirectory() to get the DCIM directory. Use getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).

    Third, use Log methods to log exceptions, rather than just display a Toast, as you may miss the Toast and you do not get the stack trace associated with your exception.

提交回复
热议问题