Search code examples
androidandroid-camera

import android.hardware.Camera does have open() method


Android Studio 0.4.6

Hello,

I am trying to use the camera and I have set the permissions like this:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware.camera"/>

I have imported the correct package:

import android.hardware.Camera;

And I try and open the camera like this:

Camera camera = Camera. there is no open method;

All I get are the following:

Parameters
Class
Size

I have follow the developer documentation, I can't see I have done anything wrong.

many thanks for any suggestions,


Solution

  • Just try to paste camera = Camera.open(); or type it in manually. Sometimes the "clever" thing glitches.

    By the way, did the tool suggest to import android.hardware.Camera; or you typed it manually? I mean, is it an Android project? (Typically you start with the automatically generated hello world example and then add extra functionality to it, if you did something else, it's easier to re-do it from the very beginning.)