Android Fail to connect to camera service
<p>When the user click on Camera, it open next screen after few seconds it throws <code>Fail to connect to camera service</code> </p>

<p>and it say  <code>cannot connect to camera</code></p>

<p>This is my code:</p>

<pre><code>   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View viewLoad = LayoutInflater.from(CameraActivity.this).inflate(R.layout.camera, null);
    setContentView(viewLoad);

    Bundle bundle = this.getIntent().getExtras();
    seletctedRetailer = bundle.getString("RetailerName");
    retailerCode = bundle.getString("RetailerCode");

    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
    Bundle b = new Bundle();
    b.putString("Activity", "RetailerOrderSActivity");
    b.putString("RetailerName", seletctedRetailer);
    b.putString("RetailerCode", retailerCode);

    cameraIntent.putExtras(b);
    getParent().getParent().setTitle("Image Capture");
    startActivityForResult(cameraIntent,CAMERA_PIC_REQUEST);  

    vale +=1;

    Button imgMCancel =(Button)findViewById(R.id.imgMCancel);
    imgMCancel.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent i = new Intent(getBaseContext(), CameraMainActivity.class);
            Bundle bundle = new Bundle(); 
            bundle.putString("Activity", "CameraMainActivity");
            bundle.putString("RetailerName", seletctedRetailer);
            bundle.putString("RetailerCode", retailerCode);
            i.putExtras(bundle);
            View vi = SalesActivityGroup.group.getLocalActivityManager().startActivity("CameraMainActivity", i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
            SalesActivityGroup.group.replaceView(vi);
        }
    });
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
    super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == CAMERA_PIC_REQUEST) {
            System.out.println("====YES======");
             Bitmap thumbnail = (Bitmap) data.getExtras().get("data");  
                ImageView image = (ImageView) findViewById(R.id.imageView1);  
                image.setImageBitmap(thumbnail);  
        }
} 
</code></pre>

<p>This is my layout : </p>

<pre><code>      &lt;?xml version="1.0" encoding="utf-8"?&gt;
</code></pre>

<p>
    
               </p>

<pre><code>    &lt;LinearLayout android:id="@+id/header"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="75dp"
                android:layout_width="fill_parent"&gt;


        &lt;Button android:layout_width="wrap_content" 
                android:text="Cancel" 
                android:textColor="#FFFFFF"
                android:background="@drawable/btn_red"
                android:layout_height="wrap_content" 
                android:layout_marginLeft="5dp"
                android:layout_marginRight="150dp"
                android:id="@+id/imgMCancel" 
                &gt;
       &lt;/Button&gt;

       &lt;Button android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:id="@+id/buttonClick"
                android:text="Make Photo" 
                android:textColor="#FFFFFF"
                android:background="@drawable/btn_red"
                android:layout_gravity="center"&gt;
        &lt;/Button&gt;


    &lt;/LinearLayout&gt;
</code></pre>

<p></p>

<p>This is my AndroidManifest.xml file</p>

<pre><code>     &lt;activity android:name=".sales.CameraActivity"              android:screenOrientation="landscape"  android:configChanges="orientation|keyboardHidden"  android:clearTaskOnLaunch="false"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.media.action.IMAGE_CAPTURE" /&gt;
            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
</code></pre>

<p>I did this according to this link <a href="http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-launching-the-camera/" rel="nofollow">http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-launching-the-camera/</a></p>

<p>Please help me what is an issue.My application contain Tab ActivityGroup.</p>

<p>Thanks in advance..</p>
