我需要根据Adapter
获取的值更改Spinner
的数据源。它在活动开始时正常工作,并且微调器的默认值为0,但是当我更改微调器的值时,它不起作用。怎么可以这样做?
这是我的EventListener
:
mySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
mViewPager.removeAllViewsInLayout();
mSectionsPagerAdapter = null;
mViewPager.removeAllViews();
switch (position){
case 0 : ListOfFood = bef;break;
case 1 : ListOfFood= chek;break;
}
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), tabbed.this, ListOfFood);
mViewPager.setAdapter(mSectionsPagerAdapter);
}
});