question: private void scrollCurrentItemToCenter ( ) { final ViewItem currItem = mViewItems [ BUFFER_CENTER ] ; if ( currItem == null ) { return ; } final int currentViewCenter = currItem . getCenterX ( ) ; if ( mController . isScrolling ( ) || mIsUserScrolling || isCurrentItemCentered ( ) ) { Log . d ( TAG , "[fling] mController.isScrolling() - " + mController . isScrolling ( ) ) ; return ; } int snapInTime = ( int ) ( SNAP_IN_CENTER_TIME_MS * ( ( float ) Math . abs ( mCenterX - currentViewCenter ) ) / mDrawArea . width ( ) ) ; Log . d ( TAG , "[fling] Scroll to center." ) ; mController . scrollToPosition ( currentViewCenter , snapInTime , false ) ; }
target:  Keep the current item in the center. This functions does not check if the current item is null.