Reputation: 3215
error:
E/BitmapFactory﹕ Unable to decode stream: java.io.FileNotFoundException: /file:/storage/sdcard0/Pictures/JPEG_20140728_190726_1641148246.jpg: open failed: ENOENT (No such file or directory)
But I can see file in F:\Pictures\JPEG_20140728_190726_1641148246.jpg
(mobile storage)
Im using methods from Taking Photos Simply | Android Developers, but if u need see code, I can copy here
I also added permsissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
All what I want is take picture using camera intent, save image, save path to database and then show it on map ...
Im testing on android 4.4.2 (CM)
Upvotes: 2
Views: 2775
Reputation: 1559
From the example you had:
mCurrentPhotoPath = "file:" + image.getAbsolutePath();
just try to use:
mCurrentPhotoPath = image.getAbsolutePath();
Upvotes: 4
Reputation: 570
I don't know why this problem exists but I figured how to avoid it. Try changing:
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
To
try {
InputStream is = new FileInputStream(file);
Bitmap bitmap = BitmapFactory.decodeStream(is);
} catch (FileNotFoundException e) { }
And it will work with no problem.
PS. I was fallowing the same android developer guide and faced the same problem as you.
Upvotes: 0
Reputation: 3253
Have you tried
new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/JPEG_20140728_190726_1641148246.jpg");
instead?
Upvotes: 0