Skip to content Skip to sidebar Skip to footer

Why My New Fragment Can't Subscribe Otto

I have made a post in my activity, and it works well in the first fragment BlankFragment, however, when I tried to replace BlankFragment with BlackFragment2, and do the same subscr

Solution 1:

Use commitNow() instead Of commit()

 FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        // Replace the contents of the container with the new fragment
        ft.replace(R.id.fragment_place, fragment);
        // or ft.add(R.id.your_placeholder, new FooFragment());
        // Complete the changes added above
        ft.commitNow();

Post a Comment for "Why My New Fragment Can't Subscribe Otto"