I ran into the problem of displaying a camera preview on an Android 2.3.6 device. I used this code to change the orientation of the camera, but for 2.3.6 it does not work, and for other versions it works correctly.


The first image in the device 2.2.1, the second image in the device 2.3.6. I want the camera preview to be the same as in 2.2.1 for device 2.3.6. Below is my code
if (Integer.parseInt(Build.VERSION.SDK) >= 8) { mCamera.setDisplayOrientation(90); } else { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { p.set("orientation", "portrait"); p.set("rotation", 90); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { p.set("orientation", "landscape"); p.set("rotation", 90); } }
And I pointed out the portrait orientation of the screen in the manifest. Give me back the solution. Thanks in advance.
source share