barteksc / AndroidPdfViewerV1

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
73 stars 31 forks source link

Not rendering in Recyclerview #3

Open sssvrock opened 7 years ago

sssvrock commented 7 years ago

Hi @barteksc ,

In general PDF contains more papers, in my case I am rendering single page with

I am displaying Each PDF file in Recyclerview using Adapter, so I can do load more for each pdf file it makes user comfort of rendering of pdf files.

While I m scrolling down the property of recyclerview is reusing the the views so at that time Pdfium core is distroyed and it is not at all rendering in scrolldown.

Here is logcat:

D/Error: 480.0 02-09 15:42:12.534 20576-20576/com.self.pdf_poc D/Error: 480.0 02-09 15:42:12.582 20576-20576/com.self.pdf_poc D/Error: 480.0 02-09 15:42:12.614 20576-20576/com.self.pdf_poc D/Error: 480.0 02-09 15:42:15.054 20576-20576/com.self.pdf_poc D/jniPdfium: Destroy FPDF library 02-09 15:42:20.513 20576-20576/com.self.pdf_poc D/AndroidRuntime: Shutting down VM 02-09 15:42:20.529 20576-20576/com.self.pdf_poc E/AndroidRuntime: FATAL EXCEPTION: main Process: com.self.pdf_poc, PID: 20576 java.lang.NullPointerException: Attempt to read from field 'long com.shockwave.pdfium.PdfDocument.mNativeDocPtr' on a null object reference at com.shockwave.pdfium.PdfiumCore.openPage(PdfiumCore.java:134) at com.github.barteksc.pdfviewer.PDFView.loadPage(PDFView.java:706) at com.github.barteksc.pdfviewer.PDFView.loadPages(PDFView.java:664)

How can I achieve my solution. Please let me know it's urgent

Thanks

sssvrock commented 7 years ago

Hi @barteksc Any update on recyclerview rendering.

because after this successful implementation I can move further. Let me know if you need more clarity on what I am doing.

Regards Vinod

sssvrock commented 7 years ago

Here is Log cat:

When I am scrolling from top to bottom and bottom to top using recyclerview:

E/com.shockwave.pdfium.PdfiumCore: mContext may be null 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at com.shockwave.pdfium.PdfiumCore.renderPageBitmap(PdfiumCore.java:229) 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:91) 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:70) 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at android.os.Looper.loop(Looper.java:148) 02-14 12:59:13.952 28809-29025/com.self.pdf_poc W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc E/com.shockwave.pdfium.PdfiumCore: mContext may be null 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at com.shockwave.pdfium.PdfiumCore.renderPageBitmap(PdfiumCore.java:229) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:91) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:70) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at android.os.Looper.loop(Looper.java:148) 02-14 12:59:14.983 28809-29025/com.self.pdf_poc W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61)