Nexus 5x reverse landscape sensor fix in a android camera preview app

The 5X camera is not “reverse”; it does report the correct camera orientation in its parameters, so no special workarounds are needed, just make sure you’re setting the display orientation correctly: 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 … Read more

How to use Android’s camera or camera2 API to support old and new API versions without deprecation notes?

Even though the old camera API is marked as deprecated, it is still fully functional, and will remain so for quite a while (as nearly all camera-using applications on the Play Store use it currently). You’ll have to ignore Android Studio’s complaints about it being deprecated, but if you want to support Android versions earlier … Read more