アプリケーションでpdfファイルを表示しようとしています。Pdf Viewer ライブラリ ( https://github.com/barteksc/AndroidPdfViewer ) を使用しています。私は資産フォルダにpdfファイルを入れました。しかし、ファイルをロードしようとすると、次の例外が表示されます。
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.secautomation/com.samsung.secautomation.ui.activities.ShowPdfActivity}: com.github.barteksc.pdfviewer.exception.FileNotFoundException: src/main/assets/test does not exist
これが私のコードです:
com.github.barteksc.pdfviewer.PDFView pdfView=(com.github.barteksc.pdfviewer.PDFView) findViewById(R.id.pdfViewer);
pdfView.fromAsset("src/main/assets/test") //test is the pdf file name
.pages(0, 2, 1, 3, 3, 3) // all pages are displayed by default
.enableSwipe(true)
.swipeHorizontal(false)
.enableDoubletap(true)
.defaultPage(0)
.enableAnnotationRendering(false)
.password(null)
.scrollHandle(null)
.load();
マニフェストファイルでの私の許可は次のとおりです。
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Ubuntu 12.04 を使用しています
この問題を解決する方法はありますか。
ありがとうございました