Try closing camera:
@Override
protected void onPause() {
super.onPause();
if (camera != null) {
camera.stopPreview();
camera.release();
camera = null;
}
}
Question
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);
Solution
Try closing camera:
@Override
protected void onPause() {
super.onPause();
if (camera != null) {
camera.stopPreview();
camera.release();
camera = null;
}
}