I've tried every way to accomplish my desired behaviour but nothing seems to work.
My app is locked in portrait mode (I don't want a landscape UI) but I want to be able to switch the camera display to show a camera preview in portrait and landscape mode alternatively.
I'm not interested in capturing images.
To show the preview in portrait I simply do:
camera.setDisplayOrientation(90);
and my preview works fine, but, when I try to show the camera preview in landscape mode, I do:
camera.setDisplayOrientation(0);
and the preview actually rotates, but the image from camera is not rotated, and the final result is just a portrait image rotated to landscape.
I've tried every way:
1) rotate the camera with parameters.setRotation()
but this affects only the final image saved and has nothing to do with the preview;
2) set parameters.set("orientation", "landscape")
but this seems to have no effect (maybe an old and not yet supported command?);
3) set every combination of the methods below, but nothing, the only way to effectively rotate the image originate from camera seems to be physically rotate my device…
This is a practical demonstration of what I mean:
As you can see, parameters.setRotation()
do not have effect on the preview, that is correct when is in portrait, but is simply rotate in landscape 'cause the camera don't rotate itself, but just place the portrait image rotated.
So, is there a way to show a camera preview in landscape when the app is in portrait?
Thanks.