title: Android Camera : data intent returns null
body: <p>I have an android application which contains multiple activities. </p>
  
  <p>In one of them I'm using a button which will call the device camera :</p>
  
  <pre><code>public void onClick(View view) {
      Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      startActivityForResult(photoIntent, IMAGE_CAPTURE);
  }
  </code></pre>
  
  <p>In the same activity I call the <code>OnActivityResult</code> method for the image result :</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (requestCode == IMAGE_CAPTURE) {
          if (resultCode == RESULT_OK) {
              Bitmap image = (Bitmap) data.getExtras().get("data");
              ImageView imageview = (ImageView) findViewById(R.id.pic);
              imageview.setImageBitmap(image);
          } else if (resultCode == RESULT_CANCELED) {
              Toast.makeText(this, "CANCELED ", Toast.LENGTH_LONG).show();
          }
      }
  }
  </code></pre>
  
  <p>The problem is that the intent <code>data</code> is null and the <code>OnActivityResult</code> method turns directly to the <code>(resultCode == RESULT_CANCELED)</code> and the application returns to the previous avtivity.</p>
  
  <p>How can I fix this issue and after calling the camera, the application returns to the current activity which contains an <code>ImageView</code> which will contains the picture taken?</p>
  
  <p>Thanks</p>