Code example for PagerAdapter

0
        return imageView;
      } 
    } 
  } 
 
  private class EmojiPagerAdapter extends PagerAdapter { 
 
    @Override 
    public int getCount() { 
      return 2; 
    } 
 
    @Override 
    public CharSequence getPageTitle(int position) {
      switch (position) {
        case 0: 
          SpannableString recent      = new SpannableString(" Recent ");
          ImageSpan       recentImage = new ImageSpan(getContext(), R.drawable.ic_emoji_recent_light,
                                                      ImageSpan.ALIGN_BASELINE);
 
          recent.setSpan(recentImage, 1, recent.length()-1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);