title: How to get file extension of a file picked with Intent.ACTION_OPEN_DOCUMENT?
body: <p>I want to get the file extension of a file I picked with Intent.ACTION_OPEN_DOCUMENT. How to get it?</p>
  
  <p>This is how I start the picker:</p>
  
  <pre><code>private void startFilePicker(){
      Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
      intent.addCategory(Intent.CATEGORY_OPENABLE);
      intent.setType("*/*");
      intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
      startActivityForResult(intent, CODE_ACTION_OPEN_DOCUMENT_FILE);
  }
  </code></pre>
  
  <p>This is callback when file is picked:</p>
  
  <pre><code>    @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
  
          //region New Picker
  
          if (requestCode == CODE_ACTION_OPEN_DOCUMENT_FILE){
              if (resultCode == RESULT_OK){
  
                  if (data != null){
                      if (data.getData() != null){
                          Uri uri = data.getData();
                          //Get file extension here.
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>When I try to get file path by doing <code>uri.getPath()</code>, I get something like <code>image:105571</code>, or <code>acc=1;doc=9204</code>. So I can't get it from path. </p>
  
  <p>The question is how to determine the file extension of picked file?</p>