I have a fatal error occurring in my onActivityResult coming back from a camera activity. What has me scratching my head is that the error is only happening on a handful of
Uri imageUri = data.getData(); //The trouble is here
There is no requirement for a camera app to return a Uri
pointing to the photo, as that is not part of the ACTION_IMAGE_CAPTURE Intent protocol. Either:
Supply EXTRA_OUTPUT
in your ACTION_IMAGE_CAPTURE
Intent
, in which case you know where the image should be stored, and do not need to rely upon getData()
, or
Use the data
extra in the response Intent
, which will be a Bitmap
of a thumbnail of the image
Your next bug is here:
String realPath = Image.getPath(this, imageUri);
There is no requirement that the image be stored as a file that you can access, unless you provide a path to that location via EXTRA_OUTPUT
.
if(resultCode == RESULT_OK){
Bitmap bitmap = (Bitmap) imageReturnedIntent.getExtras().get("data");
imageView.setImageBitmap(bitmap);
}