0
當我關閉()我的應用程序,並重新打開它onResume
, ViewPager
適配器擴展,則不會調用FragmentPagerAdapter
覆蓋方法getItem()
。我怎樣才能調用它? 這裏是我的viewPager適配器:的Android viewPager適配器
public class MyPagerAdapter extends FragmentPagerAdapter {
private final String TAG = "MyPagerAdapter";
private int MAX_COUNT = 100;
fragment1 myFragment;
public MyPagerAdapter(FragmentManager fm) {
super(fm);
Log.d(TAG, "Created adapter for pager");
}
public void setCount(int count) {
MAX_COUNT = count;
}
@Override
public Fragment getItem(int position) {
Log.d(TAG, "getting item at " + position);
myFragment = new fragment1();
myFragment.position = position;
Log.d("Fragment", "Position: " + position);
return myFragment;
}
@Override
public int getCount() {
return MAX_COUNT;
}
}