title: Opening pdf file Error: This file could not be accessed Check the location or the network and try again. Android 6 Marshmallow
body: <p>I am trying to get file from external storage, then I have to send that file to pdf readers using intents. Previously below code was working fine but after installing <strong>Android 6 (Marshmallow update)</strong>, my code is not working and getting a toast message </p>
  
  <p>"<strong>This file could not be accessed Check the location or the network and try again</strong>." </p>
  
  <p>(This is due to new android runtime permissions). 
  I just tried all the solutions (Content Providers etc but not working)
  Any Solutions?</p>
  
  <pre><code> File file = new File(getFilesDir(), "myfile.pdf");
   Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setDataAndType(Uri.fromFile(file), "application/pdf");
          intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
          Intent intentChooser = Intent.createChooser(intent, "Choose Pdf Application");
          try {
              startActivity(intentChooser);
          } catch (ActivityNotFoundException e) {
              //com.adobe.reader
              startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.adobe.reader")));
          }
  </code></pre>