Failed to save image to sdcard

后端 未结 4 1842
别跟我提以往
别跟我提以往 2021-01-13 17:11

I try to download an image with this code and save it : in this line:

OutputStream os =new FileOutputStream(f);

i try it on the emulator.my

4条回答
  •  广开言路
    2021-01-13 18:01

    Your way to detect external storage location is better than the answer of Munish Kapoor as /sdcard is not always the right folder path.

    But afterwards, are you sure that /myfolder exists as a folder. You should create a file that points to that location and call mkdirs on it to create it.

    After that, save your file inside.

提交回复
热议问题