I installed this library to view pdf from a url inside my application but when I click on the file to open it gives me the following error:
I tried looking into ContentResolver but no luck
This is the logcat:
07-26 15:35:45.638 8725-8725/com.focuson.iapp.firstapp E/PDFView: load pdf error
java.io.FileNotFoundException: No content provider: http://pub.mylaravel.eu/assets/user_files/3/file_no_1.pdf
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1093)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:944)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:797)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:751)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.getSeekableFileDescriptor(DecodingAsyncTask.java:82)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:61)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:30)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
My activity is:
public class pdfActivity extends AppCompatActivity {
PDFView pdfView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pdf);
pdfView= (PDFView) findViewById(R.id.pdfView);
String url=getIntent().getStringExtra("url");
Log.i("URI-URL",String.valueOf(Uri.parse(url)) );
pdfView.fromUri(Uri.parse(url))
.enableSwipe(true)
.enableDoubletap(true)
.swipeVertical(false)
.defaultPage(1)
.showMinimap(false)
.onLoad(new OnLoadCompleteListener() {
@Override
public void loadComplete(int nbPages) {
}
})
.onPageChange(new OnPageChangeListener() {
@Override
public void onPageChanged(int page, int pageCount) {
}
})
.enableAnnotationRendering(false)
.password(null)
.load();}}
My xml is:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.focuson.iapp.firstapp.page_types.Login.pdfActivity">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>