我的一个应用程序是这样实现:通过我的应用程序,用户可以阅读pdf文件;如果没有pdf阅读器,程序会自动从网站上下载并安装它。以下代码是用于阅读pdf文件:
File file = new File("/sdcard/sample.pdf");
PackageManager packageManager = getPackageManager();
Intent testIntent = new Intent(Intent.ACTION_VIEW);
testIntent.setType("application/pdf");
List list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0 && file.isFile()) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/pdf");
startActivity(intent);
}
现在我想问的是:
1. 如何判断电话中有没有安装adobe reader阅读器?
2. 如何在电话中以程序的方式安装adobe reader阅读器?