Im using back and front camera. When I take photo with back camera everything is ok (Preview and Result) But with front camera preview is ok while saved image is rotated. why is this happening?
Im using in surfaceCreated:
mCamera.setDisplayOrientation(90);
And in camera parameters Im using
params.setRotation(90);
And when I call front camera I have this
Button switchbtn = (Button)findViewById(R.id.switch_camera);
switchbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mCamera != null){
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
mCamera.release();
mCamera = null;
try{
int mCameraFacing = Camera.CameraInfo.CAMERA_FACING_BACK;
if (mCameraFacing == Camera.CameraInfo.CAMERA_FACING_BACK){
mCameraFacing = Camera.CameraInfo.CAMERA_FACING_FRONT;
}else {
mCameraFacing = Camera.CameraInfo.CAMERA_FACING_BACK;
}
mCamera = Camera.open(mCameraFacing);
mCamera.setPreviewDisplay(mPreview.getHolder());
mCamera.setDisplayOrientation(90);
mCamera.startPreview();
}catch (final Exception e){
e.printStackTrace();
}
}
}
});
Also one problem is that if the camera switch to from wont go back.. :/