title: How can I setup an android intent for multiple types of files (pdf, office, images, text) and return a path?
body: <p>I am new to intents and I am trying to figure out how to use parse(URI) and/or setType() to get the right types of application to open up and allow me to select things. </p>
  
  <p>I want to launch an intent from my app that will allow the user to pick one of many types of files (<code>.PDF</code>, <code>.DOCX</code>, <code>.XLSX</code>, <code>.PPTX</code>, <code>.DOC</code>, <code>.JPG</code>, <code>.PNG</code>, <code>.TXT</code>, <code>.LOG</code>, etc.). What I need the activity to return is a full path to that file. </p>
  
  <p>Right now I am using <code>setType("*/*")</code> with a chooser that I found on here, but this is automatically opening some documents selector in Android. I have file manager and other apps, and want to know what the standard setType is or MIME type. Thanks in advance. </p>
  
  <p>Also, I apologize if this has already been answered. I have looked online, but think I am searching for the wrong thing because the results I am getting are for intents that just want one of these or don't return the path.</p>
  
  <p>My applicable code is below: (Note: this is being done inside a fragment)</p>
  
  <pre><code>static final int PICK_FILE_REQUEST = 101;
  
  private String pathToFile = "";
  
  public String selectFile()  {
      String path = "";
      Intent intent = new Intent(Intent.ACTION_GET_CONTENT), chooser = null;
      intent.setType("*/*");
      chooser = Intent.createChooser(intent, "Find file to Print");
      startActivityForResult(chooser, PICK_FILE_REQUEST);
      path = pathToFile;
      return path;
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data)   {
      if(requestCode == PICK_FILE_REQUEST){
          if(resultCode == Activity.RESULT_OK){
              pathToFile = data.getDataString();
              String temp = data.getStringExtra("path");
              Log.d("Files Fragment: ", pathToFile);
              Log.d("Files Fragment: ", temp);
          }
      }
  }
  </code></pre>