title: How to find the type of a selected file after Picking the file via an Intent in Android?
body: <p>I can pick a file that is PDF or image by the following code:</p>
  <pre><code>            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
              intent.addCategory(Intent.CATEGORY_OPENABLE);
              intent.setType(&quot;*/*&quot;);
              String[] mimetypes = {&quot;image/*&quot;, &quot;application/pdf&quot;
              };
              intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
              startActivityForResult(Intent.createChooser(intent, &quot;Select a file&quot;),REQUEST_GET_SINGLE_FILE);
  </code></pre>
  <p>I receive the result in the following method:</p>
  <pre><code>    public void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
         try {
             if (resultCode == Activity.RESULT_OK) {
                if (requestCode == REQUEST_GET_SINGLE_FILE ) {
                   Uri selectedImageUri = data.getData();
                   ....
                   ....
  </code></pre>
  <p>I need to find that the selected file is a PDF or an image? How can I find the type of file?</p>