在Android应用程序中阅读pdf [英] read pdf in android application
本文介绍了在Android应用程序中阅读pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友
我需要您的帮助.
我想在我的Android应用程序中阅读PDF.
我已经把它放在我的sdcard中阅读了.我得到PDF文件的确切路径,但是我看不懂它显示空白屏幕.请帮助我阅读此PDF.
在此先感谢.
hello friends
i want some help from your side.
i want to read PDF in my android application.
i already put it in my sdcard for read. i get exact path of the PDF file but i can''t read it it display blank screen. kindly help me to read this PDF.
thanks in advance.
推荐答案
尝试一下
private void openBook()
{
File file = new File(mRealPath);
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setDataAndType(path, getString(R.string.application_type));
try
{
startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(FirstTab.this,
getString(R.string.no_application_found),
Toast.LENGTH_SHORT).show();
}
}
文件中存在Adobe Reader的问题,因此我无法读取该值.我使用其他pdf阅读器阅读pdf文件.这样我就可以轻松读取该值.加上我的旧代码.
there was problem of adobe reader in file so i cant read that value. i used other pdf reader to read the pdf file. so i can easily read the value. with my old code.
这篇关于在Android应用程序中阅读pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文