Reputation: 335
I have Activity with ViewPager that contains several Fragments. I am also using drop-down navigation in actionbar
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
To this navigation bar I have some callbacks:
actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationCallback);
My problem is that changing option in navigation list should affect all Fragments inside ViewPager.
How should I do it to be compliant with good OO principles?
Upvotes: 0
Views: 137
Reputation: 1025
I would have your fragments implement an interface like this:
public Interface NavigationListener {
public void onNavigationChanged(args...)
}
And then just call that method on each fragment in mNavigationCallback.
Upvotes: 1