public static void listFragmentRefreshStatic( GenericListItemsListFragment oldFragment, GenericListItemsListFragment newFragment) { AppState.logX( TAG, String.format( "listFragmentRefresh 2: oldFragment = %s, newFragment = %s", oldFragment, newFragment)); if (fragmentMgr != null) { fragmentMgr .beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .remove(oldFragment) .add(oldFragment.getId(), newFragment, oldFragment.getTag()) .commitAllowingStateLoss(); } }
public static void listFragmentRefreshStatic( GenericListItemsListFragment fragment, String fragmentTag) { AppState.logX( TAG, String.format( "listFragmentRefreshStatic 1: fragmentTag = %s, " + "fragmentMgr = %s", fragmentTag, fragmentMgr)); if (fragmentMgr != null) { // XXX AppState.logX( TAG, String.format( "XXX listFragmentRefreshStatic 1: backStackEntryCount " + "= %d, fragmentByTag = %s, fragmentById = %s", fragmentMgr.getBackStackEntryCount(), fragmentMgr.findFragmentByTag(fragmentTag), fragmentMgr.findFragmentById(GenericFragmentActivity.DEFAULT_FRAGMENT_CONTAINER_ID))); Fragment oldFragment; if ((oldFragment = fragmentMgr.findFragmentById( GenericFragmentActivity.DEFAULT_FRAGMENT_CONTAINER_ID)) != null && oldFragment.getTag().equals(fragmentTag)) { AppState.logX(TAG, "listFragmentRefreshStatic 1: the fragment was found"); fragment.setArguments(oldFragment.getArguments()); fragmentMgr .beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(GenericFragmentActivity.DEFAULT_FRAGMENT_CONTAINER_ID, fragment, fragmentTag) .commitAllowingStateLoss(); } else { AppState.logX(TAG, "listFragmentRefreshStatic 1: the fragment was not found"); fragmentMgr.beginTransaction().remove(null); } } }