title: open a pdf file programmatically
body: <p>I am working on pdf. I am trying to open a pdf file from my application using the code below. But I failed to open.</p>
  
  <pre><code>private void openPdf() {
  
          File file = new File("mnt/sdcard.test.pdf");
          Uri path = Uri.fromFile(file);
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          intent.setAction(Intent.ACTION_VIEW);
          intent.setData(path);
          intent.setType("application/pdf");
          try {
              startActivity(intent);
          } catch (ActivityNotFoundException e) {
              Toast.makeText(getActivity(), "No application found",
                      Toast.LENGTH_SHORT).show();
          }
      }
  </code></pre>
  
  <p>When I tried this code in emulator,it shows a toast saying "No application found"(bcoz,normally no pdf viewing application are installed in emulator). When I tested the same thing in device (specifically in funbook tab and in sony tab), it neither showed the Toast message nor it opened the pdf file. Can anybody point out the mistake in my code. Actually I am working with pdf for the first time. So my question is,</p>
  
  <ol>
  <li>In device it didn't showed the toast message, which means there is a
  pdf viewing application installed in my phone? is it right?</li>
  <li>If so, why the pdf is not opened using third party application.</li>
  <li>If I want to list all pdf viewing applications installed in my
  phone to the user, what changes should I make in this code?</li>
  </ol>