0

I have been trying to get an image from a camera intent. My code is based on the answer to How to make Android Camera Intent return full size picture .

My code for calling the camera is

public void dispatchCameraIntent(View view) {
    Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    CameraUtils.cameraImageUri = CameraUtils.getOutputMediaFileUri(this);
    camera.putExtra(MediaStore.EXTRA_OUTPUT, CameraUtils.cameraImageUri);
    startActivityForResult(camera, TAKE_PHOTO_REQUEST_CODE);
}

The file uri comes back as

file:///storage/sdcard0/Pictures/MyCameraApp/IMG_20140322_201346.jpg

My problem is that the data field in onActivityResult is always null:

protected void onActivityResult(int requestCode, int resultCode, Intent data){
  //data is null
}

I have tried few other approaches, but they all fail.

Community
  • 1
  • 1
learner
  • 11,490
  • 26
  • 97
  • 169

0 Answers0