在我的方法viewPDF()中,如何编写代码以使用Adobe Reader专门打开PDF而不是使用其他PDF应用程序?
提前致谢!
答案 0 :(得分:0)
试试这个
try {
Intent intent = new Intent();
intent.setPackage("com.adobe.reader");
intent.setDataAndType(Uri.parse(myFile), "application/pdf");
startActivity(intent);
} catch (ActivityNotFoundException activityNotFoundException) {
final String appPackageName = "com.adobe.reader";
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}