Code example for ViewPager.SimpleOnPageChangeListener

0
			return fragments.size();
		} 
	} 
	 
	// nested class is responsible for notifying when a new quote is displayed 
	private class QuotePageChangeListener extends SimpleOnPageChangeListener { 
		@Override 
		public void onPageSelected(int position) {
			// update quote index display 
			quoteIndex.setText((position + 1) + "/" + quoteFragments.size());
		} 
	} 
	 
	// adds current quote to a list of favorites (carried out by ParseXmlQuotes class) 
	public void addFavorite(View view) throws IOException {
		String added = "Added to Favorites";
		String removed = "Removed from Favorites";
		 
		if (ParseXmlQuotes.addToFavorites(getCurrentQuote().getId(), getApplicationContext())) 
			toast = Toast.makeText(getApplicationContext(), added, Toast.LENGTH_SHORT);
Stop searching for code, let great code find you!  Add Codota to your java IDE