在我的方法viewPDF()中,如何编写代码以仅使用Adobe Reader而不是其他PDF应用程序打开PDF?
提前感谢!
试试这个
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)));
}
}