Code example for FragmentManager

Methods: beginTransaction, executePendingTransactions

0
		return newFragment;
	} 
 
	private void hideFragment() { 
		final FragmentManager fm = getSupportFragmentManager();
		final FragmentTransaction ft = fm.beginTransaction();
 
		if (this.step != null) {
			hideFragmentByTag(fm, ft, this.step.getFragmentTag());
		} 
 
		ft.commit();
		fm.executePendingTransactions();
	} 
 
	private void hideFragmentByTag(@Nonnull FragmentManager fm, @Nonnull FragmentTransaction ft, @Nonnull String fragmentTag) {
		final Fragment oldFragment = fm.findFragmentByTag(fragmentTag);
		if (oldFragment != null) {
			ft.remove(oldFragment);
		} 
	}