Download PDF from url and read it
<pre><code>public void openDocumentWithInstalledApp(String filename) {
String mimetype = "";
url = url+ filename;
if (!url.startsWith("http://") &amp;&amp; !url.startsWith("https://")) {
url = "http://" + url;
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

/*what should I do?*/

mimetype = "application/pdf";
File file = new File("/mnt/sdcard/Download/" + filename);
Intent intent1 = new Intent(Intent.ACTION_VIEW);
intent1.setDataAndType(Uri.fromFile(file), mimetype);
intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent1);
}
</code></pre>

<p>First, I try to download a pdf from url.
Second, I try to read the pdf above download.
But it may not download finish.
If I want to wait the pdf download finish.
What should I do?</p>
