title: implicit intent for camera capture in android
body: <p>I am facing a very weird issue. I have an implicit intent for opening the default camera.</p>
  
  <p>There is an image view with a camera icon, which when clicked opens the default camera.</p>
  
  <p>Sometimes on clicking the imageview, opens the camera but sometimes it does not. When I click the back button, it opens the default camera. I am perplexed with this. Is it an issue in my code or device bug.</p>
  
  <p>The image view is in the grid view. As I am creating a grid view of images captured. The first image will be the camera icon and then grid will have the captured images.</p>
  
  <p>I am posting my code:</p>
  
  <p>Manifest permission: 
      
      </p>
  
  <pre><code>&lt;uses-feature android:name="android.hardware.camera" /&gt;
  </code></pre>
  
  <p>java code:</p>
  
  <pre><code>public void openCamera(String _path, String file_name) {
      File file = new File(_path);
      if (!file.exists()) {
          file.mkdirs();
      }
  
      mImageFile = new File(file + file_name);
      // create new Intent
      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mImageFile));
      mActivity.startActivityForResult(intent, 1);
  }
  
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  
      if (resultCode == RESULT_OK) {
          //user is returning from capturing an image using the camera
          if(requestCode == CAMERA_CAPTURE){
  
              //sets the adapter
  
          }
      }
  }
  </code></pre>