So I'm trying to communicate between 2 fragments which are organized in a ViewPager (Swipe-tab) by using an interface I created. Like this:
The interface looks like this:
    public interface Communicator {
        public void respond(String data);
    }
On Fragment A I reference the interface calling it 'comm', the onClick of FragmentA looks like this:
    comm = (Communicator) getActivity();
    comm.respond("String being passed");
However - when I go back to my main activity in the respond override method I try to reference my fragment and I get the nullPointer exception:
    FragmentManager manager = getSupportFragmentManager();
    FragmentB fragB = (FragmentB) manager.findFragmentById(R.id.fragmentB);
Maybe I declared the ID of the fragment in the wrong way in the XML file ? I'm a beginner so I scour the net but I'm not really sure what is it that I'm looking for, any directions will also be nice
thanks in advance
 
    