register a listener to be called when the position of the underlying view changes . concode_field_sep ArrayList<Listener> mListeners concode_elem_sep View mView concode_elem_sep int[] mPosition concode_elem_sep ViewTreeObserver.OnPreDrawListener mPreDrawListener concode_field_sep void updatePosition concode_elem_sep int getPositionX concode_elem_sep int getPositionY concode_elem_sep void notifyListeners concode_elem_sep void removeListener concode_elem_sep void clearListener
void function ( Listener arg0 ) { if ( mListeners . contains ( arg0 ) ) return ; if ( mListeners . isEmpty ( ) ) { mView . getViewTreeObserver ( ) . addOnPreDrawListener ( mPreDrawListener ) ; updatePosition ( ) ; } mListeners . add ( arg0 ) ; }