I am developing an android application which uses camera preview in the background. It is working fine across different devices.
But when tested on Nexus 5X, the camera preview is upside down. I am using these permission in manifest
<uses-permission android:name="android.permission.CAMERA" />
My camera code is as follows
public void startCamera(int myTexture)
{
surface = new SurfaceTexture(myTexture);
try {
camera = Camera.open();
} catch (Exception e) {
Log.e("MainActivity", "failed to open Camera");
e.printStackTrace();
}
try
{
camera1.setPreviewTexture(surface);
camera1.startPreview();
}
catch (IOException ioe)
{
Log.w("MainActivity","Camera launch failed");
}
}
Tried camera.setDisplayOrientation(180); But didn't work. Please Help!