标签:
if (fragments.size() > 0) {
for (int i = 0; i < fragments.size(); i++) {
FragmentTransaction transaction = supportFragmentManager.beginTransaction();
transaction.remove(fragments.get(i).getFragment());
transaction.commitAllowingStateLoss();
}
fragments.clear();
}
Log.d("aaa", "fragments=" + fragments.size());
for (int i = 0; i < titleNames.size(); i++) {
MyFragment fragment = new MyFragment();
FragmentItem fragmentItem = new FragmentItem();
Bundle bundle = new Bundle();
Log.d("aaa", "getFragments: " + titleNames.get(i).getName());
bundle.putString("text", titleNames.get(i).getName());
fragment.setArguments(bundle);
fragmentItem.setFragment(fragment);
fragmentItem.setMatter(titleNames.get(i).getName());
fragments.add(fragmentItem);
}
标签:
原文地址:http://www.cnblogs.com/bwandroid/p/5631802.html