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!
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)));
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.