0

I have a problem here and would like to know if anyone can help me solve this. I have a ViewPager, with 2 fragments, fragment A and fragment B. This viewPager is inside a fragment, we will call FragmentMain. FragmentMain contains a search, I need to send to fragment A and fragment B, which was typed in searchView, then inside fragment A and fragment B, I can "work" with text typed in searchView. Thank you! i was try it's.

João Armando
  • 167
  • 2
  • 12

1 Answers1

1

There are lot many ways or pattern to pass the data from fragment to fragment, I will list top two ways in the order of preference for cleaner & testable code:


UPDATE Otto is officially deprecated, however you can continue using it, As alternative use this

Mani
  • 2,599
  • 4
  • 30
  • 49
  • 1
    Don't use Otto, it is deprecated. There is no development happening on it. You can use RxEventBus. Have a look at https://lorentzos.com/rxjava-as-event-bus-the-right-way-10a36bdd49ba – Arun Shankar Aug 01 '17 at 01:39