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.
精彩评论