如何用Adobe Reader独家打开文件PDF?

时间:2016-06-06 20:38:29

标签: java android pdf android-studio-2.0

在我的方法viewPDF()中,如何编写代码以使用Adobe Reader专门打开PDF而不是使用其他PDF应用程序?

提前致谢!

1 个答案:

答案 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)));
   }
}