【发布时间】:2012-03-17 19:30:37
【问题描述】:
现在我正在开发一个应用程序。通过我的应用程序,用户可以阅读 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);
}
我的疑惑是:
- 如何查看手机中是否安装了adobe reader?
- 如何以编程方式在手机上安装 adobe 阅读器?
【问题讨论】:
标签: android