I am using view pager to display set of items like horizantal scroll view.So i have used pager adapter for that to load the data.My problem is when i swipe to other items when data is reloaded,it came back to the old position in which it has started.
I want to stay in the item which i am viewing now also the datas must be updated in all items.How can i achieve this?
What I have tried:
Here is my code for view pager and its adapter calling :
mScorePAgerAdapter = new ScorePagerAdapter(mContext,mFixturesList);
mScorePager.setAdapter(mScorePAgerAdapter);
int index = getLiveMatchIndex(mFixturesList);
mScorePager.setCurrentItem(index);
mScorePAgerAdapter.notifyDataSetChanged();
// isLiveMatch = checkMatchState(mFixturesList,index);
mScorePager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
setViewPagerIndicator(position,mFixturesList);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});