What you want is…
new File(uri.getPath());
… and not…
new File(uri.toString());
NOTE: url.toString()
return a String in the format: "file:///mnt/sdcard/myPicture.jpg"
, whereas url.getPath()
returns a String in the format: "/mnt/sdcard/myPicture.jpg"
,
from:
http://stackoverflow.com/questions/2975197/convert-file-uri-to-file-in-android