我的资源文件夹:
Intent intent = new Intent(this, MyPdfViewerActivity.class);
intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "PDF FILE PATH");
startActivity(intent);
我如何获得路径?
答案 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);