title: How to programmatically share multiple files of different MIME types within the same Android intent?
body: <p>I am working on an Android application that is already successfully sharing a generated PDF file via Bluetooth using the following method: </p>
  
  <pre><code>public static void sharePdfFile(Context ctx, String pathAndFile) {
      try {
          Intent share = new Intent(Intent.ACTION_SEND);
  
          share.setPackage("com.android.bluetooth");
          share.setType("application/pdf");
          share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathAndFile));
          share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
          ctx.startActivity(share);
      } catch (Exception e) {
          ExceptionDAO.Log(CATEGORY.SHARE_INTENT, e, ctx, e.getMessage(), true);
      }
  }
  </code></pre>
  
  <p>I have been asked to include a second file (CSV format) in this share intent so that both files are sent together.&nbsp; I immediately found <a href="https://stackoverflow.com/q/9957137/5152586">this question</a>, which addresses sending multiple files via Bluetooth, but only using files of the same MIME type ("video/*" in that example.)</p>
  
  <p>I have found plenty of examples of wildcard MIME <em>subtypes</em> ("video/*", "text/*", etc.) but at this point I been unable to find any examples of an Intent with more than one specific MIME type set (example: "application/pdf" and "text/comma-separated-values").&nbsp; So, I created a test method using "*/*" as the MIME type hoping that would do the trick.&nbsp; Unfortunately, my test method is not even getting far enough to activate the Bluetooth share popup to select a nearby device.</p>
  
  <p>I am not sure what I am doing wrong or have left out.&nbsp;  I cannot seem to trap any errors while debugging so I assume I'm still missing something.&nbsp; I do know the PDF and CSV files and their respective URI's are OK because both files transmit fine through the original method (I changed the MIME type and URI on the existing method to test the new CSV file.)&nbsp; </p>
  
  <p>Here is my test method:</p>
  
  <pre><code>public static void shareTwoFilesTest(Context ctx, String pathAndFile, String pathAndFile2) {
      try {
          Intent share = new Intent(Intent.ACTION_SEND_MULTIPLE);
  
          share.setPackage("com.android.bluetooth");
          share.setType("*/*");
          share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathAndFile));
          share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathAndFile2));
          share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
          ctx.startActivity(share);
      } catch (Exception e) {
          ExceptionDAO.Log(CATEGORY.SHARE_INTENT, e, ctx, e.getMessage(), true);
      }
  }
  </code></pre>