I have a problem regarding onActivityResult
not being called after opening camera from an intent:
Intent takeIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
With extra:
takeIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
On ZTE Blade III I am able to open camera, but then when I press 'tick' nothing happens, as if there was some exception in Camera itself, and the control doesn't return to calling activity - onActivityResult doesn't get called.
On other phones with never systems (ZTE is 4.0.4) everything works fine. I am also able to add "return-data" extra to the Intent but then I get thumbnail as result, which I don't want.
PS. photoFile was created the following way:
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.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
photoPath = image.getAbsolutePath();
return image;
}
wanted to add a comment but i don't have enough reputation.
did you check for null-ness of the file? before using it did you check if the file exists? did you check for external storage state? to see whether media state is mounted.
also i suspect the way you are creating your file
can you try using
new File('path/for/storage')
or its sisters?