案例:
首先,我们先看看Android如何利用第三方应用程序打开PDF文件
File tempFile = new File(path);
if (!tempFile.exists()) {
return;
}
try {
*//* Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");*//*
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.fromFile(tempFile);
intent.setDataAndType(data, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
} catch (ActivityNotFoundException ae) {
_projectUploadDetails_WebView.loadUrl("");
try {
_projectUploadDetails_WebView.removeView(docView);
} catch (Exception e) {
}
if (path.toLowerCase().endsWith(".pdf")) {