Q: can not load my image into a bitmap class in android hi i have a problem with a bitmap and a picture located here:
file:///mnt/sdcard/Android/data/com.dev.app/files/Pictures/20120924-092226.jpg

so i have a string with this url (the the file exists!)
now i need to get a bitmap, so i do:
String str = "file:///mnt/sdcard/Android/data/com.dev.app/files/Pictures/20120924-092226.jpg";
Bitmap b = BitmapFactory.decodeFile(str);

but b is always null. and i dont know why.
EDIT: i create the file before with a code like this:
String filename = DateFormat.format("yyyyMMdd-hhmmss",Calendar.getInstance().getTime()) + ".jpg";

Uri imageUri = helper.createImageDestinationUri(null, filename);

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, requestCode);


A: There are two possibilities 


*

*The file is of incorrect format, i.e although the extension is .jpg its not a jpeg file.

*The file cannot be loaded.


You may have a closer look at the adb logs to see what is going on ... if it does not helps , try the following.
Add the file in your drawable folder, and use it in some Test screen. If the file gets displayed then the file format is correct , so android is not able to load the file. Check your permissions, and actually try and read the file first using FileInputStream or somthing else.
If the file is still not displayed then you can be sure that the format is wrong. In that case just try using a different image file.
Hope it helps...
