1

Sorry for bad English.

I have BaseFragment. it contains Search View and View Pager and View pager has three fragement like Fragment A,B,C

Fragment B has Listview. so whenever i am doing search i got search response in Base fragment now what i want to do is push these response to fragment B listview inside viewpager. when every time search action perform and need to refresh listview.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • http://stackoverflow.com/questions/20553879/refresh-fragment-views-based-on-button-click – duggu Feb 12 '15 at 12:28
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders Feb 12 '15 at 22:17

1 Answers1

0

You can get an instance of the fragment you want by calling Fragment manager like this:

 CustomFragment fragment = (CustomFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_a);

and then you can call any methods of the fragment like this:

fragment.update(data);

But make sure you check the fragment is not null before calling its methods.

Saeed Entezari
  • 3,685
  • 2
  • 19
  • 40