I have a fragment that has a button.
When I click on button the system opens a dialog fragment where the user can choose some info.
In the dialog there is a button “Ok”. When the user clicks on ok, the dialog dismisses and we return on the other fragment.
I want to return to the other fragment with the result(the info choosen).
How can I do it?
There are several way to achieve this:
You can save the result from the Dialog in the activity (getActivity()) and get in from the other Fragment
You can let the base Fragment implement a callback interface and call its callback function when pressing OK from the Dialog. You’ll need to pass the interface (probably it’ll be “this”) as an argument when creating the Dialog Fragment.
Hope this helps.