This question already has an answer here:
- ViewPager PagerAdapter not updating the View 36 answers
i have this PageAdapter
with days of the week, for each pager I have the same Layout. My problem is how update the right listView when change the day. When I change the day the Pager create a new pager and delete other, when this happened my listview point to new pager but not the current. For Example, is wedneyday and I save listview reference, when i change for Tuesday the monday pager is create and Thursday is deleted, and my reference point to last page create(monday) but I'm on tuesday.
My pageAdapter:
ListView lvwConfig;
@Override
public Object instantiateItem(View pager, int position) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.pager_layout, null);
lvwConfig = (ListView) v.findViewById(R.id.lvwConfig);
((ViewPager) pager).addView(v, 0);
return v;
}
I want to the ListView
always point to listview of the current item.