[Solved] Change Activities’ Fragment Inside the Fragment


Use below method

public static void openFragment(FragmentManager manager, Fragment targetFragment) {

    try {

        String fragmentName = targetFragment.getClass().getName();
        manager.popBackStack();
        manager.beginTransaction()
                .replace(R.id.frameLayout, targetFragment, fragmentName)
                .addToBackStack(fragmentName)
                .commit();

    } catch (Exception e) {
        e.printStackTrace();
    }

}

call this method each time when you are opening your fragment. You have to pass two params to this method. targetFragment is the fragment you want to open.

1

solved Change Activities’ Fragment Inside the Fragment