Open tdao1611 opened 9 years ago
Yep I can't take images through front camera for samsung devices. It says "camera.setParameters failed in android"
In my case I resolved with : camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); You can change it for : camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT);
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean useFrontCamera = getArguments().getBoolean(FRONT_CAMERA, false); camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); // <-- THIS LINE //camera = getCameraInstance(useFrontCamera); if (camera == null) { return; } initScreenParams(); parameters = camera.getParameters();
Right now I tried to use "intent" to recreate the activity with FRONT_CAMERA set to true so that I can switch the camera but it causes a lot of bugs. Do you have an easier way for this ?