private OnClickListener createNextButtonListener ( ) { return new OnClickListener ( ) { @ Override public void onClick ( final View v ) { int selectedIndex = viewPager . getCurrentItem ( ) ; if ( notifyOnNext ( selectedIndex ) ) { viewPager . setCurrentItem ( selectedIndex + 1 ) ; } } } ; }
Creates and returns a listener which allows to show the next fragment when the corresponding button is clicked .