[英]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.