android - W/CameraBaseï¹ An error occurred while connecting to camera: 0 on camera.open() call -
I am writing a camera app and whenever I call a camera. The open () app crashes and then I get this error:
Here I am opening the camera: : If you are reading this please note that this is for the original camera API and does not apply to the latest version of the camera API (Camera 2). You should use the Camera 2 API from this point because it has more functionality and it also has a better image processing pipeline. The notification is valid only for leaving API 21 (Lollipop). To use the following method, You have to pass the camera ID, You can use the following method if you want a camera id If the same camera has been opened by another application, then it will insert a runtime exception. You should call the release () when you use the camera, otherwise it will remain locked and will be unavailable to other applications. Your camera should only have a camera object activated for a particular hardware camera at a time. w / camerabasei ?? There was an error connecting to the camera: 0
public zero getCameraInstance () {mCamera = Null; Try {mCamera = Camera.open (); // Attempt to get a camera example} Catch (exception E) {// Camera is not available (use or does not exist)}} Update
<
android.hardware.Camera.open (int cameraId)
Private AutoForFrontFacingCamera () {// front facing camera int number of cameras = camera.jetnumberoff cameras (); For (int i = 0; i
Comments
Post a Comment