So here is my problem, when i try to open the camera from my fragment i get the error "Failed to connect to camera service"
right now i have the Camera.open() on onResume() and Camera.release on onPause() and it doesn't work.
if i put the release in the same method with the open it works fine!!!!
this doesn't work
@Override
public void onResume() {
super.onResume();
Log.v("this", "camera on resume ");
camera = Camera.open();
Camera.Parameters params = camera.getParameters();
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
camera.setParameters(params);
}
@Override
public void onPause() {
super.onPause();
Log.v("this", "camera on pause ");
if (inPreview) {
camera.stopPreview();
}
camera.release();
camera = null;
inPreview = false;
}
this works (don't get an error)
@Override
public void onResume() {
super.onResume();
Log.v("this", "camera on resume ");
camera = Camera.open();
Camera.Parameters params = camera.getParameters();
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
camera.setParameters(params);
camera.release();
}
what should I do to make this work??