android-simple-tooltip: NullPointerException PopupWindow.getContentView()

if (dismissed) return; - Why this line is below mPopupWindow.getContentView() in SimpleTooltip.java?

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.widget.PopupWindow.getContentView()' on a null object reference
       at io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip$5.onGlobalLayout(SimpleTooltip.java:398)
       at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:982)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2460)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1487)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7450)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
       at android.view.Choreographer.doCallbacks(Choreographer.java:695)
       at android.view.Choreographer.doFrame(Choreographer.java:631)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:158)
       at android.app.ActivityThread.main(ActivityThread.java:7229)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @nicomazz , thanks for report.

I created a fix in branch issue-22, as I explained above, so I’m waiting for an feedback to know if it worked. Could you use this version and tell me if the errors are gone?

dependencies {
    // ...
    compile ('com.github.douglasjunior:android-simple-tooltip:issue-22-SNAPSHOT') {
        changing = true // Gradle will then check for updates every 24 hours
    }
}

This errors are rare because I believe they happen when Android closes the application for inactivity while the Tooltip is open, or something like that. That is, this does not affect the user experience. But it’s important to fix to avoid these logs stacks.

@douglasjunior Problem seems solved! No crash reports received in last 5 days!

We will integrate the issue-22 version and we may need to do some internal testing. I don’t know how to reproduce this issue but next week we will release a new version of our app to google play store and probably then we will know wheter it is fixed or not.