PagerAdapter start position

Kirill Kulakov picture Kirill Kulakov · Aug 9, 2012 · Viewed 80.8k times · Source

I'm using the following example to impliment my viewPager: http://code.google.com/p/viewpagerexample/issues/list

The problem with this example is that I can't figure out how to set my starting position, the default starting position is 0. Basically I wan't to be able to control if there is an available view on its left or the right.

Is there any way to control center's View current position? is there a better way to do it? is it possible to make it circular?

Answer

Kirill Kulakov picture Kirill Kulakov · Aug 9, 2012

I've found a way to set it's position, which is done outside of the class:

 awesomePager = (ViewPager) findViewById(R.id.awesomepager);
 awesomePager.setAdapter(awesomeAdapter);
 awesomePager.setCurrentItem(CurrentPosition);

and it can be limited by calculating the amount of items I want to fit in to it