title: ACTION_IMAGE_CAPTURE onActivityResult has empty intent with empty data
body: <p>After reading this documentation <a href="https://developer.android.com/training/camera/photobasics" rel="nofollow noreferrer">https://developer.android.com/training/camera/photobasics</a> I want to take a photo and to store the uri of the photo into a given variable. The problem is that I'm storing the variable name and the uri into the intent with <code>takePictureIntent.putExtra(Constants.INTENT_EXTRA_VARNAME, variable)</code> and <code>takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)</code>, but in onActivityResult the intent data is empty, and neither the variable and the uri stored are empty. I need to know the uri and the variable. What am I doing wrong? </p>
  
  <p>I need to pass the information as intent data because the class which is firing the action of displaying the camera is differente from the activity class.</p>
  
  <p>class with the action:</p>
  
  <pre><code>    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      takePictureIntent.putExtra(Constants.INTENT_EXTRA_VARNAME, variable);
      // Ensure that there's a camera activity to handle the intent
      if (takePictureIntent.resolveActivity(SectionManager.getInstance().getCurrentActivity().getPackageManager()) != null) {
          // Create the File where the photo should go
          File photoFile = null;
          try {
              photoFile = createImageFile();
          } catch (IOException ex) {
              ex.printStackTrace();
          }
          // Continue only if the File was successfully created
          if (photoFile != null) {
              Uri photoURI = FileProvider.getUriForFile(SectionManager.getInstance().getCurrentActivity(), SectionManager.getInstance().getCurrentActivity().getPackageName(), photoFile);
              takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
              SectionManager.getInstance().getCurrentActivity().startActivityForResult(takePictureIntent, Constants.REQUEST_IMAGE_CAPTURE);
          }
      }
  </code></pre>
  
  <p>my activity which receives the result:</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent intent) {
      if( requestCode == Constants.REQUEST_IMAGE_CAPTURE &amp;&amp; resultCode == RESULT_OK){
          String varName;
          String path;
  
          if(intent != null) {
              varName = intent.getStringExtra(Constants.INTENT_EXTRA_VARNAME);
              path = Util.getRealPathFromURI(SectionManager.getInstance().getCurrentActivity(), intent.getData());
              Log.d(DEBUG_TAG, "onActivityResult-&gt; varName: "+varName+" path: "+path);
              if (varName != null &amp;&amp; path != null) {
                  VariableManager.put(varName, path);
              }
          }
      }
  }
  </code></pre>
  
  <p>manifest, permission write_external_storage and this code:</p>
  
  <pre><code>    &lt;provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="${applicationId}"
          android:exported="false"
          android:grantUriPermissions="true"&gt;
          &lt;meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
              android:resource="@xml/file_paths"&gt;&lt;/meta-data&gt;
      &lt;/provider&gt;
  </code></pre>
  
  <p>file_paths.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;external-path name="my_images" path="/" /&gt;
  &lt;/paths&gt;
  </code></pre>