title: Android: Open saved file in default app from my app
body: <p>First off, sorry if this has been asked but I cannot find it. I am downloading documents in my app from a remote resource. Once the document is downloaded, I want to open it for the user. What I want to know is how do I check if they have an application to handle Pdf or Tiff and launch it in the default application for them?  </p>
  
  <p>Thank you.</p>
  
  <p><strong>edit</strong></p>
  
  <p>here is part of the solution:</p>
  
  <pre><code>Intent viewDoc = new Intent(Intent.ACTION_VIEW);
  viewDoc.setDataAndType(
      Uri.fromFile(getFileStreamPath("test.pdf")), 
      "application/pdf");
  
  PackageManager pm = getPackageManager();
  List&lt;ResolveInfo&gt; apps = 
      pm.queryIntentActivities(viewDoc, PackageManager.MATCH_DEFAULT_ONLY);
  
  if (apps.size() &gt; 0)
      startActivity(viewDoc);
  </code></pre>