0

I'm trying to use the built in camera app to take a picture and save it. It works fine if it just takes a p[icture. When I add the copde to save the pictures, the camera app crashes when I exit from it code

takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);       
try {
    File f  = new File(getFilesDir(), "test");
    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));   
} catch (Exception e) {
    gi++;
}
startActivityForResult(takePictureIntent, 1);
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
Ted pottel
  • 6,869
  • 21
  • 75
  • 134

1 Answers1

0

Try closing camera:

@Override
      protected void onPause() {
      super.onPause();
        if (camera != null) {
            camera.stopPreview();
            camera.release();
            camera = null;
    }
}
ZG-RG
  • 97
  • 10