1

I would like to launch the native Android camera and save the image at a specified location. The problem is after I click the capture photo, the preview comes up with the options to Save/Discard. After I click save, the native camera rotates in landscape and the image I captured is not displayed.

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            intent.setPackage(defaultCamera);
            File f = new File(android.os.Environment.getExternalStorageDirectory(), "temp.jpg");
            intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
            startActivityForResult(intent, 1); 
BaCaRoZzo
  • 7,502
  • 6
  • 51
  • 82

1 Answers1

0

It is because the activity is recreated therefore data is not there anymore. You cannot control whether that will happen or not. Do you capture the picture onActivityResult? If so, you could try saving the path in a retained fragment.

Alex
  • 108
  • 1
  • 11