public void openDocumentWithInstalledApp(String filename) {
String mimetype = "";
url = url+ filename;
if (!url.startsWith("http://") && !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);
}
首先我想从url中下载一个PDF,然后我想读取下载的pdf。但是它可能没有下载结束,如果我想等到 pdf 下载结束。要如何做呢?