I have an activity in which I am adding fragments.There is a Fragment(WhenFragment) on which I add another fragment (DateSelectionFragment) to get the date and when I back press I need that date and want to set in a text view.I used OnFragmentInteractionListener for this which returns result in WhenFragment correctly.But I am not able to access Textview in that OnFragmentInteractionListener implementation to set date to it.
@Override
public void onFragmentInteraction(Bundle bundle) {
mBinding.textView.setText(bundle.getString("result"),"");
}
To get back to WhenFragment I am using
getActivity().onBackPressed();
mListener.onFragmentInteraction(bundle);
It is giving nullPointerException. Any help is highly appreciated.