DImuthuUpe / AndroidPdfViewer

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
8.18k stars 1.91k forks source link

activity页面接入pdfview后 秒开秒关pdf页面会闪退 #1086

Open ZhuoJunErGe opened 2 years ago

ZhuoJunErGe commented 2 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' on a null object reference at com.github.barteksc.pdfviewer.PDFView.W(SourceFile:3) at ie.c.c(SourceFile:4) at ie.c.onPostExecute(SourceFile:1) at android.os.AsyncTask.finish(AsyncTask.java:797) at android.os.AsyncTask.access$900(AsyncTask.java:195) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:814) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8668) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)

ZhuoJunErGe commented 2 years ago

应该是是这段判断中renderingHandlerThread空指针引起的 void loadComplete(PdfFile pdfFile) { state = State.LOADED;

    this.pdfFile = pdfFile;

    if (!renderingHandlerThread.isAlive()) {
        renderingHandlerThread.start();
    }
happinessforever commented 1 year ago

请问你是怎么解决的呀