I'm taking a photo using the take photo intent and saving it to disk. This function returns the image file that is passed to the Take Photo Intent.
Later I read the image file using this path.
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStorageDirectory();
storageDir.mkdirs();
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
mPhotoPath = image.getAbsolutePath();
return image;
}
This code works fine on my Nexus 4 device, mPhotoPath contains a valid path.
On the Samsung Galaxy S5 (SM-G900V) running 5.0 mPhotoPath is null.