Camera.getNumberOfCameras() not working on Android 2.2

后端 未结 2 1475
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 03:53

I am trying to use API Camera.getNumberOfCameras() but getting error \"Cannot find symbol\" while compiling. My API level is 8. Can anyone please tell me whats

2条回答
  •  时光说笑
    2021-01-18 04:15

    I know its an old post.But updating for new comers.

    From API21 Camera class is deprecated.Instead we have to use Camera2 class. For gettng connected devices,you have to use something like

    private CameraManager mManager;
    private String[] mCameraIds;
    mManager = (CameraManager)getSystemService(Context.CAMERA_SERVICE);
    mCameraIds = mManager.getCameraIdList();
    

    You can find documentation here

提交回复
热议问题