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

前端 未结 3 1574
轮回少年
轮回少年 2020-12-03 03:51

I am kind of newbie in Android development, so my apologies in advance if my question is trivial. In one part of my app I need a live preview of my rear camera, so I created

3条回答
  •  一生所求
    2020-12-03 04:36

    Same here. Since camera2 doesn't support devices < API 21, and don't want to implement the two APIs, it would be nice do get a quick fix.

    I'm trying somthing like :

    if (Build.MODEL.equals("Nexus 5x")){
         // rotate camera 180°
         mCamera.setDisplayOrientation(180);
    }
    

    But can't rotate the display of the camera. Gonna check if there is something to do with the PreviewCallback

    Is it a bad thing to use the 2 apis ? As in this topic, it is not recommended : How to use Android's camera or camera2 API to support old and new API versions without deprecation notes?

提交回复
热议问题