In an Activity, I can choose an image from the Gallery, and I need its Uri path (in the log, the Uri path for my test image is /content:/media/external/images/media/1
).
I'm getting this error though:
08-04 02:14:21.912: DEBUG/PHOTOUPLOADER(576): java.io.FileNotFoundException: /content:/media/external/images/media/1 (No such file or directory)
08-04 02:14:32.124: WARN/System.err(576): java.io.FileNotFoundException: /content:/media/external/images/media/1 (No such file or directory)
Is this the correct format of a file path? Or should I make it to be something like sdcard\...\image.png
?
InputStream inputStream = getContentResolver().openInputStream(uri)
is all you need.this works for all SDK's Versions :
taken from here : https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java
try {
if you have problem not solve till you can visit here for complete example