Error with camera app
I checked the log cat in android studio and these are the errors it displays ...
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method
'android.hardware.Camera$Parameters
android.hardware.Camera.getParameters()'on a null object reference
at .easyCamView.takePicture(easyCamView.java:146)
Actual Code:
mPictureFileName = fileName;
Parameters params = mCamera.getParameters();
java.lang.RuntimeException: Fail to connect to camera service
at .easyCamView.surfaceCreated(easyCamView.java:191)
Intent openIntent = new Intent();
openIntent.setAction(Intent.ACTION_VIEW);
mContext.startActivity(openIntent);
mCamera = Camera.open();
at easyCamActivity.captureScreen(easyCamActivity.java:179)
mCameraView.takePicture(fileName);
I am able to compile the code but it crashes whenever I run it. if I can get some help that would be great.
Please sign in to leave a comment.
See this thread: https://stackoverflow.com/questions/34569733/java-runtimeexception-fail-to-connect-to-camera-service
Please use StackOverflow for general programming questions. This forum is created to discuss IDE-related questions.
Thank you.