I created a helper method, which ensures that the fragment is added only if it does not exist:
public static void addFragmentOnlyOnce(FragmentManager fragmentManager, Fragment fragment, String tag) {
Simply calling itself of Activity or another fragment:
addFragmentOnlyOnce(getFragmentManager(), myFragment, "myTag");
It works with both android.app packages. *, And so with android.support.app packages. *.
source share