Fail to connect to camera service, Error -2147483648
<p>I want to open a new Camera instance on an Android phone using:</p>

<pre><code>camera = Camera.open();
</code></pre>

<p>Before I do that I check if there is a camera with the PacketManager. I also added the <code>permission.CAMERA</code> and the feature <code>hardware.camera</code> in the manifest. If I try to open the instance I always get a </p>

<pre><code>01-05 13:47:48.720: E/Camera(6555): Error -2147483648
</code></pre>

<p>Can anyone tell me why this happen and how I could open an instance?</p>

<pre><code>    01-05 16:54:39.670: E/AndroidRuntime(9295): FATAL EXCEPTION: Thread-17341
    01-05 16:54:39.670: E/AndroidRuntime(9295): java.lang.RuntimeException: Fail to   connect to camera service
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at    android.hardware.Camera.native_setup(Native Method)
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at android.hardware.Camera.&lt;init&gt;(Camera.java:302)
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at android.hardware.Camera.open(Camera.java:279)
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at com.arcticcoding.nxtphone.MainActivity$GetCameraInstance.getCameraInstance(MainActivity.java:73)
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at com.arcticcoding.nxtphone.MainActivity$GetCameraInstance.run(MainActivity.java:84)
    01-05 16:54:39.670: E/AndroidRuntime(9295):     at java.lang.Thread.run(Thread.java:856)
</code></pre>

<p>And here is my method for opening the camera instance</p>

<pre><code>    private Camera getCameraInstance() {
    Camera camera = null;
    try {
        Log.d(TAG, "Opening camera instance");
        camera = Camera.open();
    } catch(Exception e) {
        Log.d(TAG, "Error while opening camera");
        e.printStackTrace();
    }
    return camera;
}
</code></pre>

<h2>Manifest</h2>

<pre><code>    ...
    &lt;uses-permission android:name="android.permission.CAMERA"/&gt;
    &lt;uses-feature android:name="android.hardware.camera"/&gt;
    ...
</code></pre>
