title: android java lang runtimeexception fail to connect to camera service
body: <p>I am currently working on Flashlight On/OFF. I am getting this error <code>java.lang.RuntimeException: Fail to connect to camera service</code> I don't know why this error is occurring. I referred to many solutions but my problem was still not solved. When flashlight is on, the error does not occur but when the flashlight is off then the error occurs.</p>
  
  <p>My Code <a href="http://pastie.org/9227625">Main Code</a>.</p>
  
  <p>My Manifest permission: </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus"/&gt;
  </code></pre>