package xushuai.viewpager_indicator_demo; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import com.viewpagerindicator.CirclePageIndicator; public class SampleCirclesInitialPage extends BaseSampleActivity { private CircleAdapter mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_circles); mAdapter = new CircleAdapter(getSupportFragmentManager()); mPager = (ViewPager)findViewById(R.id.pager); mPager.setAdapter(mAdapter); mIndicator = (CirclePageIndicator)findViewById(R.id.indicator); mIndicator.setViewPager(mPager); mIndicator.setCurrentItem(mAdapter.getCount() - 1); //You can also do: indicator.setViewPager(pager, initialPage); } }