[英]How open file PDF exclusively with Adobe reader?
在我的方法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)));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.