android - Orientation camera all time wrong -


i can't set correct orientation on preview of camera, try things work. want see preview camera android app, orientation of activity landscape, don't know if correct or wrong. in continuous line explain try: - change setdisplayorientation(90) works if phone vertical, when change orientation wrong again. - try set portrait, when image saved orientation wrong, , if try change exif time orientation 0, not works. - read ask's on so, , works.

i want kill smartphone, object , not have life. thx lot.

android camera stuff extremely frustrating, understand that. make sure read through of camera documentation , check out code below referenced here:

public static void setcameradisplayorientation(activity activity,          int cameraid, android.hardware.camera camera) {      android.hardware.camera.camerainfo info =              new android.hardware.camera.camerainfo();      android.hardware.camera.getcamerainfo(cameraid, info);      int rotation = activity.getwindowmanager().getdefaultdisplay()              .getrotation();      int degrees = 0;      switch (rotation) {          case surface.rotation_0: degrees = 0; break;          case surface.rotation_90: degrees = 90; break;          case surface.rotation_180: degrees = 180; break;          case surface.rotation_270: degrees = 270; break;      }       int result;      if (info.facing == camera.camerainfo.camera_facing_front) {          result = (info.orientation + degrees) % 360;          result = (360 - result) % 360;  // compensate mirror      } else {  // back-facing          result = (info.orientation - degrees + 360) % 360;      }      camera.setdisplayorientation(result);  } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -