Question

  • I have the following situation: I open the Fragment A and goals, through a click event of the button, go to the Fragment B. When I am in Fragment B and hit the back button (in order to return to the Fragment A) I would like to pass some parameters to Fragment A. Does anyone know how I can do this?
  • Thank you in advance to all.
Was it helpful?

Solution

Your activity can implement a custom listener interface on the Activity and use a reference to it in your fragment to pass the communication back.

OTHER TIPS

You can send a broadcast when you hit the back button in Fragment B to Fragment A with the parameters you need put in the bundle, and have broadcast receiver on the Fragment A.

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top