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 o
I'm using 3 fragments and on starting my app, the second (middle) fragment will be shown by default. Just I'm using the onResume function and all works great.
@Override
protected void onResume() {
super.onResume();
m_viewPager.setCurrentItem(1);
}
Using viewPager.setCurrentItem(newPosition);
shows to the user the transition from the starting page to the newPosition
, to prevent that from happening and show the newPosition
directly as if it was the starting point, I added false
to the second parameter something like this:
int newPosition = pages.size()-1; // Get last page position
viewPager.setCurrentItem(newPosition, false); // 2nd parameter (false) stands for "smoothScroll"
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