Camera : setDisplayOrientation function is not working for Samsung Galaxy ACE with Android 2.3.6

為{幸葍}努か 提交于 2019-11-27 11:57:36

When I had a similar problem with the original Galaxy Tab running 2.2.1, I was able to solve it by doing the following:

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

However, it looks like you may have already tried that exact combination, given that you have identical (but commented out) code above. However, the way you have the code right now, the Ace is going to bypass where you have that commented code because of it's API level (10). Try it specifically inside this block:

if (currentSDKVersion != 7) { }

And let me know if it works, please. Thanks!

I was searching for a solution for hours too. Its really crazy. My solution was to just use the camera preview in landscape mode (in my portrait app) and mask out the parts of the preview I don't need. I did this by overlaying upper and lower pars of my fullscreen preview with some views. Of cause you have to crop the photo you are getting from the camera then, WHICH RESULTS IN LESS RESOLUTION. For my app this was no issue.

I am totally happy with my solution now- users don't see any difference;

droidx

I have handled camera by writing some code that was majorly adapted from the ZXing project: http://code.google.com/p/zxing/

You could try using those. If you are trying to use this, I would recommend going through the solution of this stackoverflow question

This may not be the perfect solution to your question, but I had ran through this issue and had decided to use Zxing.

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