문제

내장 된 카메라 앱을 사용하여 사진을 찍고 저장하려고합니다. AP [icture 만 사용하면 잘 작동합니다. 사진을 저장하기 위해 COPDE를 추가하면 IT 코드에서 종료하면 카메라 앱이 충돌합니다.

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);
도움이 되었습니까?

해결책

카메라를 닫으십시오 :

@Override
      protected void onPause() {
      super.onPause();
        if (camera != null) {
            camera.stopPreview();
            camera.release();
            camera = null;
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top