title: How to open PDF file from internal storage in Oreo?
body: <p>I try to open PDF file in Oreo but it does not open. I don't get any error. What is the issue? PDF file does not open. Only black screen is shown. In logcat no errors show. What is wrong?</p>
  
  <p>How Can I resolve this issue? I referred many links but did not get solution. I also tried many codes but no help.</p>
  
  <p>My Code is:</p>
  
  <pre><code>   File file11 = new File(Environment.getExternalStorageDirectory().
     getAbsolutePath(), 
     "AtmiyaImages/" + nameoffile1);
      Intent target = new Intent(Intent.ACTION_VIEW);
      target.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          if(Build.VERSION.SDK_INT&gt;24){
          Uri uri=FileProvider.getUriForFile(AssignmentActivity.this,
          getPackageName()+".provider",file11);
          target.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
          target.putExtra(Intent.EXTRA_STREAM,uri);
          target.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          target.setType("application/pdf");
          Intent intent=Intent.createChooser(target,"Open File");
          try
          {
          startActivity(intent);
          }
          catch(ActivityNotFoundException e)
          {
          Toast.makeText(AssignmentActivity.this,"No Apps 
         can performs This acttion",Toast.LENGTH_LONG).show();
          }
          }
  
          else
          {
          target.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
          target.setDataAndType(Uri.fromFile(file11),"application/pdf");
          target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
          Intent intent=Intent.createChooser(target,"Open File");
          try
          {
          startActivity(intent);
          }
          catch(ActivityNotFoundException e)
          {
          Toast.makeText(AssignmentActivity.this,"No Apps can performs This 
          acttion",Toast.LENGTH_LONG).show();
          }
  
          }
  </code></pre>
  
  <p>In <strong>Manifest</strong> I also add</p>
  
  <pre><code>   &lt;provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="com.infinity.infoway.atmiya.fileprovider"
          android:exported="false"
          android:grantUriPermissions="true"&gt;
          &lt;meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
                  android:resource="@xml/provider_paths"/&gt;
         &lt;/provider&gt;
  </code></pre>
  
  <p>And My <strong>Xml code</strong> is:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths&gt;
  &lt;external-path
   name="Phonestorage"
  path="/storage/emulated/0/AtmiyaImages"/&gt;
  &lt;/paths&gt;
  </code></pre>