@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_titles);

    mAdapter = new TestFragmentAdapter(getSupportFragmentManager());

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);

    mIndicator = (CustomViewPageIndicator) findViewById(R.id.indicator);
    mIndicator.setViewPager(mPager);

    // We set this on the indicator, NOT the pager
    mIndicator.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageSelected(int position) {
            Toast.makeText(
                    SampleTitlesWithListenerInActionBar.this,
                    "Changed to page " + position,
                    Toast.LENGTH_SHORT)
                .show();
          }

          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageScrollStateChanged(int state) {}
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_icons);

    mAdapter = new TestSpinnerFragmentAdapter(getSupportFragmentManager(), this);
    mAdapter.setSize(10);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);

    mIndicator = (CustomViewPageIndicator) findViewById(R.id.indicator);
    mIndicator.setViewPager(mPager);
  }