I have an Activity A. And in stepperLayout of this activity I use Fragment B. I call dialogFragment C from Fragment B. Than on DialogFragment C i call listenerInterface method but listener Interface is null. So there was a null pointer exception. Activity A not implement the interface. Only fragment B implements it.
My Fragment B
dialogFragmentC = DialogFragmentC .newInstance();
dialogFragmentC .show(getFragmentManager(), "");
My DialogFragment C
@Override
public void onAttach(Context context) {
super.onAttach(context);
try {
this.listener = (DialogFragmentListener) context;
} catch (Exception e) {
Timber.i(e);
}
}