0

Noticed that my app is getting runtimeexceptions and arrayoutofboundsexception. I traced the problem to this area of my code

 mCameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
    try {
        mCameraId = mCameraManager.getCameraIdList()[0];
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }

I get an error saying that "Call requires API Level 21 (current min is 14):android.hardware.camera2.CameraManager#getCameraIdList

What's the best way to fix this?

screenshot

1 Answers1

0

Look at the answer here - https://stackoverflow.com/a/28417458/1649353.
It clearly states that you need to use the old camera if you want to support older devices. Give it a try.

Community
  • 1
  • 1
Ambuj Kathotiya
  • 369
  • 4
  • 18