Code example for ViewTreeObserver

Methods: isAlive, removeGlobalOnLayoutListener

0
 
	public void onDismiss() { 
		mPopup = null;
		mMenu.close();
		if (mTreeObserver != null) {
			if (!mTreeObserver.isAlive())
				mTreeObserver = mAnchorView.getViewTreeObserver();
			mTreeObserver.removeGlobalOnLayoutListener(this);
			mTreeObserver = null;
		} 
		// mAnchorView.removeOnAttachStateChangeListener(this); 
	} 
 
	public boolean isShowing() { 
		return mPopup != null && mPopup.isShowing();
	} 
 
	@Override 
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		MenuAdapter adapter = mAdapter;