title: File not found error after selecting a file in android
body: <p>I want to open a .pdf file in my android app.now i can browse the pdf file and after browsing the file I am getting <strong><em>File Not Found</em></strong> Error when i check the file exist or not. Now after selecting the file my selected file Uri <code>data.getData()</code> is like </p>
  
  <p><code>content://com.android.externalstorage.documents/document/6333-6131:SHIDHIN.pdf</code></p>
  
  <p>and the path when i parse using <code>data.getData().getPath().toString()</code> is like </p>
  
  <p><code>/document/6333-6131:SHIDHIN.pdf</code> Here is my code. Please Help me.</p>
  
  <pre><code>// To Browse the file
  
  Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
  intent.setType("application/pdf");
  startActivityForResult(intent, PICK_FILE_REQUEST);
  </code></pre>
  
  <p>After selecting file </p>
  
  <pre><code>//onActivityResult
  
  public void onActivityResult(final int requestCode, int resultCode, Intent data) {
      try {
          switch (requestCode) {
              case PICK_FILE_REQUEST:
                  if (resultCode == RESULT_OK) {
                      try {
                          Uri fileUri = data.getData();
                          String path  = fileUri.getPath().toString();
                          File f = new File(path);
                          if (f.exists()) {
                              System.out.println("\n**** Uri :&gt; "+fileUri.toString());
                              System.out.println("\n**** Path :&gt; "+path.toString());
                              final Intent intent = new Intent(MainActivity.this, ViewPdf.class);
                              intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
                              startActivity(intent);
                          } else {
                              System.out.println("\n**** File Not Exist :&gt; "+path);
                          }
  
                      } catch (Exception e) {
                          ShowDialog_Ok("Error", "Cannot Open File");
                      }
                  }
                  break;
          }
      } catch (Exception e) {
      }
  }
  </code></pre>