I created a fragment and I'm trying to call it when I click on a button, but it gives an error and it appears in the console
com.example.gustavo.easypasse.RecargaActivity@30d409a0 must implement OnFragmentInteractionListener
And point to this line of code:
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
How do I fix this?