Code example for ViewPager

Methods: setOnPageChangeListener

0
 
public class MultiBroadcastViewPager extends ViewPager { 
    private List<ViewPager.OnPageChangeListener> listeners = new ArrayList<OnPageChangeListener>();
 
    public MultiBroadcastViewPager(Context context) {
        super(context);
        super.setOnPageChangeListener(new PageScrollListener(listeners));
    } 
 
    public MultiBroadcastViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    } 
 
    public void addPageChangeListener(OnPageChangeListener listener){
        listeners.add(listener);
 
    } 
 
    public void removePageChangeListener(OnPageChangeListener listener){
        listeners.remove(listener);
    }