Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException at com.github.barteksc.pdfviewer.PDFView.loadComplete #1019

Open
MdTayoburRahman opened this issue Jul 8, 2021 · 1 comment

Comments

@MdTayoburRahman
Copy link

java.lang.NullPointerException:
at com.github.barteksc.pdfviewer.PDFView.loadComplete (PDFView.java)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute (DecodingAsyncTask.java)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute (DecodingAsyncTask.java)
at android.os.AsyncTask.finish (AsyncTask.java:695)
at android.os.AsyncTask.access$600 (AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:712)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7094)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)

@taichushouwang
Copy link

Refer to this submission #824
I create a subclass, change the renderingHandlerThread. And it work.

class MyPdfView(context: Context, set: AttributeSet) : PDFView(context, set) {
    override fun onAttachedToWindow() {
        super.onAttachedToWindow()
        val field: Field = PDFView::class.java.getDeclaredField("renderingHandlerThread")
        field.isAccessible = true
        if (field.get(this) == null) {
            field.set(this, HandlerThread("PDF renderer"))
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants