0

in my method viewPDF(), how can i write code to open PDF exclusively with Adobe reader and not with other PDF app?

Thanks in advance!

ZAO
  • 5
  • 5

1 Answers1

0

try this

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)));
   }
}
Tomer Shemesh
  • 10,278
  • 4
  • 21
  • 44