Reputation: 1550
I would like to know if it is possible to display a specific fragment
in a view pager
. What I have at the moment is a Gridview
and the onClick
sends a id via Intent to a viewPager
. The View pager
has six items. So how would I go about displaying the third Fragment
? (with an id of 2).
Upvotes: 1
Views: 1382
Reputation: 81
Use the ViewPager setCurrentItem method. You probably want the param smoothScroll to be false, so it seems like it's always been at that position:
viewPager.setCurrentItem(2, false);
Upvotes: 4