查看以下网站: https ://github.com/jblough/Android-Pdf-Viewer-Library
他列出了以下代码:
Intent intent = new Intent(this, YourPdfViewerActivity.class);
intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, "PATH TO PDF GOES HERE");
startActivity(intent);
该路径将是什么以及我将放置此 PDF 文件的位置?
我在assets文件夹res/raw中放置了一个测试PDF文件。从数据/数据/项目中的 ddms 以及 libs 文件夹中推送一个文件。我尝试了以下方法,但仍然找不到文件:
String path = Environment.getExternalStorageDirectory().getPath();
String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "test.pdf";
String path = "android.resource://com.example.test3/raw/test.pdf";
String path = "file:///android_assets/test.pdf";
String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.pdf";