我在我的应用程序中有resource/raw/color_chart_ciao.pdf
中的PDF文件。我想在我的应用程序中显示该文件。我已经为此编写代码:在android应用程序中显示pdf
File file = new File("http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf");
System.out.println("FIle Path is" + file);
if (file.exists()) {
System.out.println("FIle Path is" + file);
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
System.out.println("pdf show");
}
catch (ActivityNotFoundException e) {
Toast.makeText(CiaoView.this,
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
}
但是当我运行我的应用程序时,我无法在我的应用程序中看到PDF。 我在应用程序开发中更新鲜。所以请帮助解决这个问题。
感谢ü非常 – user642347