code: 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));
          }
      }
docs: Initialize ViewPagerIndicator with a properly set up ViewPager
  @param viewPager an instance of android.support.v4.view.ViewPager
  @throws IllegalStateException if no adapter has been provided to the viewPager