title: How to open a PDF via Intent from SD card
body: <p>I'm trying to launch an <code>Intent</code> to open a pdf inside my assets folder in my app. I've read dozens of posts but am still stuck. Apparently I need to copy the pdf to the sd card first then launch an <code>Intent</code>. It still doesn't work.</p>
  
  <p>I think the problem is the <code>Intent</code> launching so I'm simply trying to open a file "example.pdf" that I copied onto the SD card using this code:</p>
  
  <pre><code>Log.w("IR", "TRYING TO RENDER: " + Environment.getExternalStorageDirectory().getAbsolutePath()+"/example.pdf");
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setDataAndType(Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath()+"/example.pdf"), "application/pdf");
  intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
  try {
      startActivity(intent);
      Log.e("IR", "No exception");
  } 
  catch (ActivityNotFoundException e) {
      Log.e("IR", "error: " + e.getMessage());
      Toast.makeText(InvestorRelations.this, 
          "No Application Available to View PDF", 
          Toast.LENGTH_SHORT).show();
  }
  </code></pre>
  
  <p>This is my LogCat output.</p>
  
  <pre><code>05-10 10:35:10.950: W/IR(4508): TRYING TO RENDER: /mnt/sdcard/example.pdf
  05-10 10:35:10.960: E/IR(4508): No exception
  </code></pre>
  
  <p>Except when this code is run, I get the following Toast (not produced by my app)</p>
  
  <p>"Not a supported document type"</p>
  
  <p>But I can open the document manually through the PDF viewing app installed. Any help would be hugely appreciated.</p>