Search code examples
cameraandroid

Camera.open() is not working android


I am trying to write a custom camera application in android. For that I need to open the camera application.

for that i am tring following code..

Camera camera = Camera.open();

but is showing error like

method open undefined for type Camera

i did as suggested here http://developer.android.com/reference/android/hardware/Camera.html#open(int)

any suggestion..

Thanks, Ravindra Gupta


Solution

  • You most likely imported the wrong camera class at the top of your source file, which is android.graphics.Camera.

    You need android.hardware.Camera instead.

    Thanks