Buggy code:
public class PinnedHeaderExpandableListView extends ExpandableListView implements OnScrollListener { private static final String TAG = "PinnedHeaderExpandableListView" ; private static final boolean DEBUG = true ; public interface OnHeaderUpdateListener { public View getPinnedHeader ( ) { } public void updatePinnedHeader ( View headerView , int firstVisibleGroupPos ) { } } private View mHeaderView ; private int mHeaderWidth ; private int mHeaderHeight ; private View mTouchTarget ; private OnScrollListener mScrollListener ; private PinnedHeaderExpandableListView . OnHeaderUpdateListener mHeaderUpdateListener ; private boolean mActionDownHappened = false ; protected boolean mIsHeaderGroupClickable = true ; public PinnedHeaderExpandableListView ( Context context ) { } public PinnedHeaderExpandableListView ( Context context , AttributeSet attrs ) { } public PinnedHeaderExpandableListView ( Context context , AttributeSet attrs , int defStyle ) { } private void initView ( ) { } @ Override public void setOnScrollListener ( OnScrollListener l ) { } public void setOnGroupClickListener ( OnGroupClickListener onGroupClickListener , boolean isHeaderGroupClickable ) { } public void setOnHeaderUpdateListener ( PinnedHeaderExpandableListView . OnHeaderUpdateListener listener ) { } @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { } @ Override protected void onLayout ( boolean changed , int l , int t , int r , int b ) { } @ Override protected void dispatchDraw ( Canvas canvas ) { } @ Override public boolean dispatchTouchEvent ( MotionEvent ev ) { } private View getTouchTarget ( View view , int x , int y ) { } private boolean isTouchPointInView ( View view , int x , int y ) { } public void requestRefreshHeader ( ) { } protected void refreshHeader ( ) { if ( ( mHeaderView ) == null ) { return ; } int firstVisiblePos = getFirstVisiblePosition ( ) ; int pos = firstVisiblePos + 1 ; int firstVisibleGroupPos = getPackedPositionGroup ( getExpandableListPosition ( firstVisiblePos ) ) ; int group = getPackedPositionGroup ( getExpandableListPosition ( pos ) ) ; if ( PinnedHeaderExpandableListView . DEBUG ) { <START_BUG> Log . w ( PinnedHeaderExpandableListView . TAG , ( "refreshHeader<seq2seq4repair_space>firstVisibleGroupPos=" + firstVisibleGroupPos ) ) ; <END_BUG> } if ( group == ( firstVisibleGroupPos + 1 ) ) { View view = getChildAt ( 1 ) ; if ( view == null ) { Log . w ( PinnedHeaderExpandableListView . TAG , "Warning<seq2seq4repair_space>:<seq2seq4repair_space>refreshHeader<seq2seq4repair_space>getChildAt(1)=null" ) ; return ; } if ( ( view . getTop ( ) ) <= ( mHeaderHeight ) ) { int delta = ( mHeaderHeight ) - ( view . getTop ( ) ) ; mHeaderView . layout ( 0 , ( - delta ) , mHeaderWidth , ( ( mHeaderHeight ) - delta ) ) ; } else { mHeaderView . layout ( 0 , 0 , mHeaderWidth , mHeaderHeight ) ; } } else { mHeaderView . layout ( 0 , 0 , mHeaderWidth , mHeaderHeight ) ; } if ( ( mHeaderUpdateListener ) != null ) { mHeaderUpdateListener . updatePinnedHeader ( mHeaderView , firstVisibleGroupPos ) ; } } @ Override public void onScrollStateChanged ( AbsListView view , int scrollState ) { } @ Override public void onScroll ( AbsListView view , int firstVisibleItem , int visibleItemCount , int totalItemCount ) { } No newline ; at end ; of file ; }

Fix:
Log . d ( PinnedHeaderExpandableListView . TAG , ( "refreshHeader<seq2seq4repair_space>firstVisibleGroupPos=" + firstVisibleGroupPos ) ) ;