I am using a Preview to display what the camera see's on the screen.
I can get everything working fine, surface created, surface set and the surface is displayed.
However it always displays the picture at an incorrect 90 degree angle in portrait mode.
Such as in the picture:
I am aware that using the following code will set the picture straight:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
However I have the Preview within an Activity that has other elements in it and it does not make sense for my Activity to be displayed in landscape mode. (Its disabled by default)
So I was wondering is there anyway to just change the orientation of the Preview? And leave the rest of my Activity correctly displayed in Portrait mode?
Or anyway to rotate the preview so that it is displayed correctly?
try this code
try to set the display orientation. It solves my problem.
I did it taking advice of mCamera.setDisplayOrientation(90); but also rotated the bitmap because for some reason the others approaches doesnt work for me in version 2.3.3.
For rotate the bitmap i did this:
This piece of line worked for me perfectly
I am having problem with front Camera(Upside down issue). Then i use this method