I'm currently working in a single activity application that is using fragments for each screen. I'm also using MVP design pattern.
Context
What I want?
How can I pass Fragment-A as a Listener to the DialogFragment (Fragment-B), so I can call the actions from the DialogFragment?
Assuming your DialogFragment
is a child fragment of the other Fragment (you're passing in getChildFragmentManager()
to show()
) as it should be, then your FragmentA
will get a callback to onAttachFragment()
:
Called when a fragment is attached as a child of this fragment.
This gives you a reference to the child DialogFragment, where you can then set any listener you want.