Sometimes I need to update UI from different Fragments. But it seems that writing update method in each Fragment is absurd if I have a lot of Fragment to handle with.
Here is a better solution by using Observer pattern, IMO.
Sample
Define an EventObject, which is a event(or message) will be passed to Observer.
publicclassViewPagerTabsextendsLinearLayoutimplementsObserver{/* ... */@Overridepublicvoidupdate(Observableobservable,Objectdata){// TODO Auto-generated method stubViewPagerTabsUIEventObjecteventObject=(ViewPagerTabsUIEventObject)data;switch(eventObject.getEventType()){caseLABEL_OFF:// do somethingbreak;caseLABEL_ON:// do something elsebreak;default:break;}}}