Code example for ViewTreeObserver

Methods: isAliveremoveGlobalOnLayoutListener

0
    @SuppressWarnings("deprecation") 
    public void onDismiss() { 
        mPopup = null;
        mMenu.close();
        if (mTreeObserver != null) {
            if (!mTreeObserver.isAlive()) {
                mTreeObserver = mAnchorView.getViewTreeObserver();
            } 
            mTreeObserver.removeGlobalOnLayoutListener(this);
            mTreeObserver = null;
        } 
        if (mAnchorView instanceof View_HasStateListenerSupport) {
            ((View_HasStateListenerSupport) mAnchorView)
                    .removeOnAttachStateChangeListener(this);
        } 
    } 
 
    @Override 
    public void onGlobalLayout() { 
        if (isShowing()) { 
Connect your IDE to all the code out there  Get Codota for Java