Android API Version Compatibility

人走茶凉 提交于 2019-12-04 03:34:15

Try:

Camera.Parameters parameters = camera.getParameters();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
    parameters.setRotation(90);
    camera.setParameters(parameters);
} else {
    camera.setDisplayOrientation(90);
}

There's no general way to change the camera to orientation to portrait mode prior to v2.2. The set("orientation", "portrait") works on some devices and not on others.

It seemed odd to me as well.

linuxbuild

Try to call Activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) in onConfigurationChanged callback OR discover a source code of Camera.setDisplayOrientation method from Android 2.2 (or 2.3) and try to implement something similar in your application.

See also related question at stackoverflow.com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!