I am using the default camera intent to get the image in my app. The problem is camera returns null on onActivityResult()
. The ResultCode
and
Seems you know the imageUri before onActivityResult. This is not correct answer but will work fine.
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
// This image uri only you're going to use
So don't use
Uri imageuri = data.getData();
just use the uri you known.
your code looks like this:
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
//use imageUri here to access the image
imageView.setImageFromUri(imageUri); // imageUri should be global in the activity
}
}