Android: cannot get camera instance
<p>I have a simple test class</p>

<p>public class MainActivity extends Activity {</p>

<pre><code>@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    Camera a = Camera.open();
}
</code></pre>

<p>}</p>

<p>and manifest file</p>

<p>
</p>

<pre><code>&lt;uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" /&gt;

    &lt;uses-feature android:name="android.hardware.camera" /&gt;
&lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;

&lt;application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name="com.example.cameratest.MainActivity"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
&lt;/application&gt;
</code></pre>

<p></p>

<p>After application running i have exception</p>

<pre><code>01-31 10:05:46.033: E/AndroidRuntime(17154): FATAL EXCEPTION: main
01-31 10:05:46.033: E/AndroidRuntime(17154): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cameratest/com.example.cameratest.MainActivity}: java.lang.RuntimeException: Fail to connect to camera service
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread.access$600(ActivityThread.java:128)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.os.Looper.loop(Looper.java:137)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread.main(ActivityThread.java:4514)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at java.lang.reflect.Method.invokeNative(Native Method)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at java.lang.reflect.Method.invoke(Method.java:511)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at dalvik.system.NativeStart.main(Native Method)
01-31 10:05:46.033: E/AndroidRuntime(17154): Caused by: java.lang.RuntimeException: Fail to connect to camera service
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.hardware.Camera.native_setup(Native Method)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.hardware.Camera.&lt;init&gt;(Camera.java:349)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.hardware.Camera.open(Camera.java:326)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at com.example.cameratest.MainActivity.onCreate(MainActivity.java:17)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.Activity.performCreate(Activity.java:4465)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
01-31 10:05:46.033: E/AndroidRuntime(17154):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
01-31 10:05:46.033: E/AndroidRuntime(17154):    ... 11 more
</code></pre>

<p>What I do wrong ? My device definitely has a camera and its works on other apps...</p>
