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?