在Android中打开PDF使用Adobe Reader [英] Open PDF in Android with Adobe Reader
本文介绍了在Android中打开PDF使用Adobe Reader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
href=\"http://stackoverflow.com/questions/13468710/open-pdf-in-android\">打开PDF
Possible Duplicate:
Open PDF in Android
我想从我的Android应用程序中打开使用Adobe Reader PDF文件。
I would like to open a PDF file with Adobe Reader from my android application.
我在的/ mnt / SD卡叫的test.pdf的PDF文件,而我使用的下一个code:
I've a PDF file in /mnt/sdcard called test.pdf, and I'm using the next code:
file = new File ("/mnt/sdcard/test.pdf");
if (file.exists())
{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
intent.setType("application/pdf");
intent.setPackage("com.adobe.reader");
startActivity(intent);
}
在执行此code则Adobe Reader打开,但文件未打开。该文件是有效的。
Adobe Reader is opened when this code is executed, but the file is not opened. The file is valid.
这是什么问题?
推荐答案
试试这个。
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
这篇关于在Android中打开PDF使用Adobe Reader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文