public void addFragment(int containerViewId, String tag, Fragment fragment, boolean replace) { fragmentsById.put(containerViewId, fragment); fragmentsByTag.put(tag, fragment); ShadowFragment shadowFragment = shadowOf(fragment); shadowFragment.setTag(tag); shadowFragment.setContainerViewId(containerViewId); shadowFragment.setShouldReplace(replace); shadowFragment.setActivity(activity); fragment.onAttach(activity); fragment.onCreate(shadowFragment.getSavedInstanceState()); }
fragmentsByTag.put(tag, fragment); shadowOf(fragment).setTag(tag); shadowOf(fragment).setContainerViewId(containerViewId); shadowOf(fragment).setShouldReplace(replace);