title: How do I implement view recycling mechanism for PagerAdapter?
body: <p>I have a pager adapter that suppose to inflate a complex view representing a calendar.</p>
  
  <p>It takes around ~350 ms to inflate each year of the calendar.</p>
  
  <p>To improve performance I would like to implement the same mechanism that exists in the <code>ListView</code> array adapter of recycling views (<code>convertView</code> parameter in <code>getView()</code>).</p>
  
  <p>Here is my current <code>getView()</code> from the adapter.</p>
  
  <pre><code>@Override
  protected View getView(VerticalViewPager pager, final DateTileGrid currentDataItem, int position)
  {
      mInflater = LayoutInflater.from(pager.getContext());
  
          // This is were i would like to understand weather is should use a recycled view or create a new one.
      View datesGridView = mInflater.inflate(R.layout.fragment_dates_grid_page, pager, false);
  
  
      DateTileGridView datesGrid = (DateTileGridView) datesGridView.findViewById(R.id.datesGridMainGrid);
      TextView yearTitle = (TextView) datesGridView.findViewById(R.id.datesGridYearTextView);
      yearTitle.setText(currentDataItem.getCurrentYear() + "");
      DateTileView[] tiles = datesGrid.getTiles();
  
      for (int i = 0; i &lt; 12; i++)
      {
          String pictureCount = currentDataItem.getTile(i).getPictureCount().toString();
          tiles[i].setCenterLabel(pictureCount);
          final int finalI = i;
          tiles[i].setOnCheckedChangeListener(new DateTileView.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(DateTileView tileChecked, boolean isChecked)
              {
                  DateTile tile = currentDataItem.getTile(finalI);
                  tile.isSelected(isChecked);
              }
          });
      }
  
      return datesGridView;
  }
  </code></pre>
  
  <p>Any pointers or direction for implementing such a behavior?
  In particular how can I know in the adapter that one of the <code>DateTileGridViews</code> is being swiped of the screen so I could save it in memory to reuse it next time.</p>