NullPointerException when I call method of interface (fragments communication)
<p>My app works with a TabLayout (and so a ViewPager).</p>

<p>I have a Fragment A and a Fragment B. My goal is to recover data from my EditTexts of Fragment A to, obviously, print and works with them in my Fragment B.</p>

<p>For this, I use an interface named <code>ButtonCliked</code>, but seems not to work well. Did I forgot something ?</p>

<p><strong>TabFragment.java (use to manage my fragments)</strong></p>

<pre><code>public class TabFragment extends Fragment implements EquationsCalculFragment.ButtonClicked {


    public static TabLayout tabLayout;
    public static ViewPager viewPager;
    public static int int_items = 3 ;

    @Override
    public void sendResultats(float a, float b) {
        EquationsResultatFragment fragRes = (EquationsResultatFragment) getFragmentManager().findFragmentById(R.id.Equa_2nd_ResLayout);
        fragRes.getResultat(a, b);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        /**
         *Inflate tab_layout and setup Views.
         */
        View x =  inflater.inflate(R.layout.tab_layout,null);
        tabLayout = (TabLayout) x.findViewById(R.id.tabs);
        viewPager = (ViewPager) x.findViewById(R.id.viewpager);

        /**
         *Set an Apater for the View Pager
         */
        viewPager.setAdapter(new MyAdapter(getChildFragmentManager()));

        tabLayout.post(new Runnable() {
            @Override
            public void run() {
                tabLayout.setupWithViewPager(viewPager);
            }
        });

        return x;

    }

    class MyAdapter extends FragmentPagerAdapter{

        public MyAdapter(FragmentManager fm) {
            super(fm);
        }

        /**
         * Return fragment with respect to Position .
         */

        @Override
        public Fragment getItem(int position)
        {
            switch (position){
                case 0 : return new EquationsCalculFragment();
                case 1 : return new EquationsResultatFragment();
                case 2 : return new EquationsInfosFragment();
            }
            return null;
        }

        @Override
        public int getCount() {

            return int_items;

        }

        /**
         * This method returns the title of the tab according to the position.
         */

        @Override
        public CharSequence getPageTitle(int position) {

            switch (position){
                case 0 :
                    return "Calcul";
                case 1 :
                    return "Résultats";
                case 2 :
                    return "Infos";
            }
            return null;
        }
    }
}
</code></pre>

<p><strong>Fragment A : EquationsCalculFragment.java</strong></p>

<pre><code>public class EquationsCalculFragment extends Fragment {

    private String aS;
    private String bS;

    private EquationsCalculFragment.ButtonClicked callEqua2ndRes;

    public interface ButtonClicked {
        void sendResultats(float a, float b);
    }

    private ViewPager viewPager;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_equations_calcul, container, false);

        viewPager = (ViewPager) getActivity().findViewById(R.id.viewpager);

        final EditText champ_a = (EditText) view.findViewById(R.id.equa_2nd_a);
        final EditText champ_b = (EditText) view.findViewById(R.id.equa_2nd_b);

        Button button = (Button) view.findViewById(R.id.btn_equations_resultats);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                bS = champ_b.getText().toString();
                aS = champ_a.getText().toString();
                callEqua2ndRes.sendResultats(Float.parseFloat(aS), Float.parseFloat(bS));
                viewPager.setCurrentItem(1, true);
            }
        });
        return view;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);

        // This makes sure that the container activity has implemented
        // the callback interface. If not, it throws an exception
        try {
            if (context instanceof EquationsCalculFragment.ButtonClicked) {
                callEqua2ndRes = (EquationsCalculFragment.ButtonClicked) context;
            }
        } catch (ClassCastException e) {
            throw new ClassCastException(context.toString()
                    + " must implement ButtonClicked");
        }
    }

    @Override
    public void onDetach() {
        callEqua2ndRes = null;
        super.onDetach();
    }
}
</code></pre>

<p><strong>Fragment B : EquationsResultatFragment.java</strong></p>

<pre><code>public class EquationsResultatFragment extends Fragment {
    private TextView results;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_equations_resultat, container, false);

        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        results = (TextView) getView().findViewById(R.id.equa_2nd_resultat);
    }

    public void getResultat(float a, float b) {
        results.setText(String.valueOf((a*a)+(2*a*b)+(b*b)));
    }
}
</code></pre>

<p>Is there anything I'm doing wrong ?</p>