I have 3 fragments in which, each one has a function for search. in my MainActivity, I created a view pager and pass these fragments to it. I also have an edit text in my MainActivity that gets user input. I want to pass this input to a function that is located in fragments. that function calls an API and does a search. but I can't access to that fragment. how should I do? in fact, I want to have a search page like what Instagram has.
Asked
Active
Viewed 99 times
1 Answers
0
All fragments should have a modelView in common, you can add the search result to a var within the view. If they do not share a common model view AKA they are parts of a different MVC you can add a shared component a singleton that will hold the data, notice that you have sync mechanizem if you use this method.

error86
- 102
- 1
- 10