title: File not found when using file after selecting it Android
body: <p>similar to this question <a href="https://stackoverflow.com/questions/30075095/file-not-found-error-after-selecting-a-file-in-android">File not found error after selecting a file in android</a> , I get a file not found exception after I select a file from SD however the solution in the question provided did not work for me, but also resulted in another file not found exception. Here is my code, and it throws a filenotfoundexception exactly at the indicated line with an arrow</p>
  
  <pre><code>private void fileChooser() {
      Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
      intent.setType("*/*");
      intent.addCategory(Intent.CATEGORY_OPENABLE);
  
      try {
          startActivityForResult(
                  Intent.createChooser(intent, "Select a File to Upload"),0);
      } catch (android.content.ActivityNotFoundException ex) {
          // Potentially direct the user to the Market with a Dialog
          Toast.makeText(this, "Please install a File Manager.",
                  Toast.LENGTH_SHORT).show();
      }
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      switch (requestCode) {
          case 0:
              if (resultCode == RESULT_OK) {
                  // Get the Uri of the selected file
                  Uri uri = data.getData();
                  // Get the path
                  try {
                      File f=new File(uri.getPath());
                      Bitmap mBitmap=null;
                      screenRuntime.getRewriteMachine().addSendFile(f);
  
                      ParcelFileDescriptor pfd=ParcelFileDescriptor.open(f,ParcelFileDescriptor.MODE_READ_ONLY); &lt;-------------
                      PdfRenderer renderer=new PdfRenderer(pfd);
                      final int pageCount = renderer.getPageCount();
  
                      for (int i = 0; i &lt; pageCount; i++) {
                          PdfRenderer.Page page = renderer.openPage(i);
  
                          // say we render for showing on the screen
                          page.render(mBitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
  
                          // do stuff with the bitmap
  
                          // close the page
                          page.close();
                      }
                      RelativeLayout rl=(RelativeLayout)findViewById(R.id.mainContent);
                      rl.setBackground(new BitmapDrawable(content.getResources(),mBitmap));
                      // close the renderer
                      renderer.close();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  Log.wtf("Sent file","Sent file");
                  // Get the file instance
                  // File file = new File(path);
                  // Initiate the upload
              }
              break;
      }
      super.onActivityResult(requestCode, resultCode, data);
  }
  </code></pre>
  
  <p>Can anyone tell me why the solution in the link does not work for me? or what I could do to fix this? or what could possibly be going wrong?
  Here is a copy of the log</p>
  
  <p>line 110 is ParcelFileDescriptor pfd=ParcelFileDescriptor.open(f,ParcelFileDescriptor.MODE_READ_ONLY); </p>
  
  <pre><code>02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕          java.io.FileNotFoundException: No such file or directory
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.os.Parcel.openFileDescriptor(Native Method)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:253)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:199)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at cmu.edu.screenshare.MainActivity.onActivityResult(MainActivity.java:110)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.Activity.dispatchActivityResult(Activity.java:6160)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.ActivityThread.deliverResults(ActivityThread.java:3877)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.ActivityThread.handleSendResult(ActivityThread.java:3931)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.ActivityThread.access$1300(ActivityThread.java:144)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1408)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.os.Looper.loop(Looper.java:155)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5696)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at java.lang.reflect.Method.invoke(Native Method)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:372)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
  02-16 14:50:22.969  26284-26284/cmu.edu.screenshare W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
  </code></pre>
  
  <p>Thanks!</p>