With Fragments you always have to implement an interface
.
Create the
interface
in the fragment which is to communicate with the other fragment.Implement the
interface
in yourMainActivity
or theActivity
class.Call on the
getArguments
in theonActivityCreated()
to avoid anyNullPointerExceptions
.
For more see this.