title: Android Intents - Difference between SetDataAndType and just setData and setType?
body: <p>So I am writing an intent that should launch the gallery to view an image passed into the intent with it's Uri. This code works fine, does exactly what I want it to do:</p>
  
  <pre><code>private Intent makeGalleryIntent(String pathToImageFile) {
      Intent mGalleryIntent = new Intent(Intent.ACTION_VIEW);
      mGalleryIntent.setDataAndType(Uri.parse("file://" + pathToImageFile), "image/*");
      return mGalleryIntent;
  }
  </code></pre>
  
  <p>But when I tried to play with it (just trying different things out as I learn), this code either crashes on the emulator because it can't launch the camera, or just pulls up my gallery on my physical device:</p>
  
  <pre><code>private Intent makeGalleryIntent(String pathToImageFile) {
      Intent mGalleryIntent = new Intent(Intent.ACTION_VIEW);
      mGalleryIntent.setData(Uri.parse("file://" + pathToImageFile));
      mGalleryIntent.setType("image/*");
      return mGalleryIntent;
  }
  </code></pre>
  
  <p>They both look like they should do the exact same thing. Also, is there a way I could have set all of that properly just using the Intent constructor?</p>