title: Android Camera: intent in onActivityResult is always null
body: <p>I want to get the pic taken by the camera, but the intent in onActivityResult is always null, I've tried several ways, but they didn't work. Here is the code i use camera:</p>
  
  <pre><code>private static final int REQUEST_FROM_CAMERA = 37;
  
  public void takePhotoByCamera() {
      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      File file = new File(Environment.getExternalStorageDirectory(),
            "nameOfFile" + String.valueOf(System.currentTimeMillis()) + ".jpg");
      Const.uri = Uri.fromFile(file);
      intent.putExtra(MediaStore.EXTRA_OUTPUT, Const.uri);
      intent.putExtra("return data", true);
      ((UploadLicenseActivity) mContext).startActivityForResult(intent, REQUEST_FROM_CAMERA);
  }
  </code></pre>
  
  <p>I provided MediaStore.EXTRA_OUTPUT and test the uri is not null.</p>
  
  <p>And onActivityResult:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
          if (data == null)
              Log.e("data", "data is null");
          else if (data.getData() == null)
              Log.e("data.getData", "data.getData is null");
  
          if (requestCode == REQUEST_FROM_CAMERA &amp;&amp; null != data &amp;&amp; null != data.getData()) {
              if (null != Const.uri) {
                  uploadLicensePresenter.startCropActivity(Const.uri);
              } else {
                  Toast.makeText(this, "Cannot retrieve selected image.", Toast.LENGTH_SHORT).show();
              }
          }
      }
  }
  </code></pre>
  
  <p>The logcat: </p>
  
  <p>03-21 13:45:49.705 16424-16424/com.ssl.pdpatrol E/data: data is null</p>
  
  <p>Why data is null, and how can I solve it?</p>