Android资源文件夹pdf路径

时间:2013-11-28 10:23:55

标签: android file pdf path assets

我的资源文件夹:enter image description here

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "PDF FILE PATH"); startActivity(intent);

我如何获得路径?

2 个答案:

答案 0 :(得分:0)

尝试使用:

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "file:///android_asset/xy.pdf"); startActivity(intent);

答案 1 :(得分:0)

试试这个

 Uri path = Uri.parse("file:///android_asset/about.pdf");
 Intent intent  = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(path, "application/pdf");
 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActivity(intent);