Code example for PagerAdapter

0
 
  /* 
   * Inspired by 
   * https://gist.github.com/8cbe094bb7a783e37ad1 
   */ 
  private class SampleAdapter extends PagerAdapter { 
    @Override 
    public Object instantiateItem(ViewGroup container, int position) {
      View page=
          getLayoutInflater().inflate(R.layout.page, container, false);
      TextView tv=(TextView)page.findViewById(R.id.text);
 
      position=position * 2;
 
      populateTextView(tv, position);
      position++;
      tv=(TextView)page.findViewById(R.id.text2);
 
      if (position < getRealCount()) {
        populateTextView(tv, position);
        tv.setVisibility(View.VISIBLE);