Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suggest you to use : <strong>Configuration.ORIENTATION_LANDSCAPE</strong> to support Landscape Preview</p> <p>Edit Answer:</p> <pre><code>@Override public void surfaceCreated(SurfaceHolder surfaceHolder) { try { Camera.Parameters parameters = mCamera.getParameters(); if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) { parameters.set("orientation", "portrait"); mCamera.setDisplayOrientation(90); parameters.setRotation(90); } else { // This is an undocumented although widely known feature parameters.set("orientation", "landscape"); // For Android 2.2 and above mCamera.setDisplayOrientation(0); // Uncomment for Android 2.0 and above parameters.setRotation(0); } mCamera.setPreviewDisplay(surfaceHolder); mCamera.startPreview(); } catch (IOException e) { // left blank for now } } @Override public void surfaceDestroyed(SurfaceHolder surfaceHolder) { mCamera.stopPreview(); mCamera.release(); } @Override public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) { try { Camera.Parameters parameters = mCamera.getParameters(); if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) { parameters.set("orientation", "portrait"); mCamera.setDisplayOrientation(90); parameters.setRotation(90); mCamera.setPreviewDisplay(surfaceHolder); mCamera.startPreview(); } else { // This is an undocumented although widely known feature parameters.set("orientation", "landscape"); // For Android 2.2 and above mCamera.setDisplayOrientation(0); // Uncomment for Android 2.0 and above parameters.setRotation(0); } mCamera.setPreviewDisplay(surfaceHolder); mCamera.startPreview(); } catch (IOException e) { // left blank for now } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload