我有以下方法可以返回不同的片段:
@Override
public SherlockFragment getItem(int position) {
SherlockFragment fragment = null;
if (position == 0) {
fragment = new MyFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
} else if (position == 1) {
fragment = new MyFragment2();
Bundle args = new Bundle();
fragment.setArguments(args);
} else if (position == 2) {
fragment = new MyListFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
}
return fragment;
}
如何返回 2 次 SherlockFragment 和 1 次 SherlockListFragment?