Android Inbuild(ActionImageCapture) intent returns null intent .Cannot deliver result {who= null}

前端 未结 1 531
轻奢々
轻奢々 2021-01-13 08:06

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

相关标签:
1条回答
  • 2021-01-13 08:38

    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
      }
    }
    
    0 讨论(0)
提交回复
热议问题