开发者

java.io.FileNotFoundException: /sdcard/DCIM/ROBIN.jpg (No such file or directory)

开发者 https://www.devze.com 2023-02-24 16:44 出处:网络
I\'m getting an error on the following line of co开发者_运维百科de: FileInputStream is = new FileInputStream(\"/sdcard/DCIM/ROBIN.jpg\");

I'm getting an error on the following line of co开发者_运维百科de:

FileInputStream is = new FileInputStream("/sdcard/DCIM/ROBIN.jpg");

The error is:

java.io.FileNotFoundException: /sdcard/DCIM/ROBIN.jpg (No such file or directory)

But the image is present in the directory

My USB connection is Charge only


Never hardcode paths like /sdcard. For example, /sdcard is wrong on most Android devices. Use Environment.getExternalStorageDirectory() to find the root of external storage.


Make sure you have set the permission WRITE_EXTERNAL_STORAGE in your manifest.

0

精彩评论

暂无评论...
验证码 换一张
取 消