1.
@Override
protected void onSaveInstanceState(Bundle outState) {
//super.onSaveInstanceState(outState);
}
2.
@Override
public voidonAttachFragment(Fragment fragment) {
super.onAttachFragment(fragment);
if(mainFragment==null&& fragmentinstanceofMainFragment)
mainFragment= (MainFragment) fragment;
if(antStoreFragment==null&& fragmentinstanceofAntStoreFragment)
antStoreFragment= (AntStoreFragment) fragment;
if(shoppingFragment==null&& fragmentinstanceofShoppingFragment)
shoppingFragment= (ShoppingFragment) fragment;
if(mineFragment==null&& fragmentinstanceofMineFragment)
mineFragment= (MineFragment) fragment;
}
3
protected void onSaveInstanceState(Bundle outState) {
FragmentTransaction transaction = fm.beginTransaction();
transaction.remove(tab1);
transaction.remove(tab2);
transaction.remove(tab3);
transaction.remove(tab4);
transaction.commitAllowingStateLoss();
super.onSaveInstanceState(outState);
}
网友评论