João Armando
João Armando

Reputation: 167

Sending data to a fragment already created

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.

Upvotes: 0

Views: 164

Answers (1)

Mani
Mani

Reputation: 2649

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

Upvotes: 1

Related Questions