I think this is the issue:
Fragment fragment = manager.findFragmentById(R.id.main_fragment_container);
if (fragment == null) {
fragment = new FragmentA();
manager.beginTransaction()
.add(R.id.main_fragment_container, fragment)
.commit();
}
f1 = (FragmentA) manager.findFragmentById(R.id.main_fragment_container);
f1.setCommunicator(this);
In the first instance if
manager.findFragmentById
returns
null
then you create a new
FragmentA
object. But in the second case you do not check to see if you have received a valid object. And looking at the XML I suspect the actual id that is declared is not being recognised as the id of a fragment.