public void initWithViewPager ( ViewPager viewPager ) throws IllegalStateException { if ( viewPager == null ) return ; if ( viewPager . getAdapter ( ) == null ) throw new IllegalStateException ( "ViewPager has no adapter set." ) ; try { mViewPager = viewPager ; mViewPager . addOnPageChangeListener ( mOnPageChangeListener ) ; addViews ( ) ; } catch ( Exception e ) { Log . e ( TAG , getMessageFor ( e ) ) ; } }
Initialize ViewPagerIndicator with a properly set up ViewPager