Yalantis / CameraModule

Simple camera module for android applications
https://yalantis.com/
686 stars 193 forks source link

I tried to switch the camera from "back" to "front" but still got errors. #10

Open tdao1611 opened 9 years ago

tdao1611 commented 9 years ago

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 ?

Kabir121 commented 8 years ago

Yep I can't take images through front camera for samsung devices. It says "camera.setParameters failed in android"

Montsserrat commented 6 years ago

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();