title: Android - Camera preview is sideways
body: <p>I am using a Preview to display what the camera see's on the screen.</p>
  
  <p>I can get everything working fine, surface created, surface set and the surface is displayed.</p>
  
  <p>However it always displays the picture at an incorrect 90 degree angle in portrait mode.</p>
  
  <p>Such as in the picture:</p>
  
  <p><img src="https://i.stack.imgur.com/PuWMu.jpg" alt="alt text"></p>
  
  <p>I am aware that using the following code will set the picture straight:</p>
  
  <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  </code></pre>
  
  <p>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)</p>
  
  <p>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?</p>
  
  <p>Or anyway to rotate the preview so that it is displayed correctly?</p>