Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera.open() and setPreviewDisplay() undefined for the type Camera

Tags:

android

camera

I am receiving an error while trying to open a camera through mCamera = Camera.open(); option. The error says: The method open() undefined for the type Camera

The same error also appears for the following methods:

mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
mCamera.stopPreview();
mCamera.lock();
mCamera.release();

Can someone help me with this please?

like image 338
avinashk14 Avatar asked Feb 24 '26 12:02

avinashk14


1 Answers

Check your imports. I had a similar problem and the Camera object Eclipse chose for me was: import android.graphics.Camera; instead it should be: import android.hardware.Camera;

like image 121
KDavid Avatar answered Feb 26 '26 03:02

KDavid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!