ANDROID: Camera

When using the camera, you might see a weird error where in portrait, the camera preview shows 2 screens instead of one. This is because the camera orientation is LANDSCAPE by default. To fix this issue, you can do one of 2 things...

(1) Force your application to be in landscape by using the following in the manifest.xml



(2) Alter the camera parameters to account for the orientation differences:

Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);

NOTE: If your application is not of fixed-orientation, you will have to detect the orientation of the application and adjust the 2nd parameter string accordingly between "portrait" and "landscape"

No comments: