title: Getting error in my onBindViewHolder in my recyclerview adapter
body: <p>I am trying to implement like google plus animation in my <code>RecyclerView</code>'s <code>CardView</code>. I get an error in my <code>onBindViewHolder</code> method.</p>
  
  <p>The error cannot resolve symbol <code>lastPosition</code> and cannot resolve symbol <code>position</code> here my two errors.</p>
  
  <p>This here my <code>onBindViewHolder</code> method code:</p>
  
  <pre><code>public class SimpleCardViewAdapter extends  RecyclerView.Adapter&lt;SimpleCardViewAdapter.ViewHolder&gt; {
  
  
  
  
  
  private List&lt;CardViewData&gt; mDataset;
  
  public SimpleCardViewAdapter(List&lt;CardViewData&gt; dataset) {
      mDataset = dataset;
  }
  
  @Override
  public ViewHolder onCreateViewHolder(final ViewGroup viewGroup, int i) {
      View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.primary_layout, viewGroup, false);
      return new ViewHolder(v);
  }
  
  @Override
  public void onBindViewHolder(final ViewHolder viewHolder, int i) {
      final CardViewData cardViewData = mDataset.get(i);
  
      viewHolder.mTitle.setText(cardViewData.getTitle());
      viewHolder.mDescription.setText(cardViewData.getDescription());
      viewHolder.mImage.setImageResource(cardViewData.getImage());
  
      Animation animation = AnimationUtils.loadAnimation(context,
              (i &gt; lastPosition) ? R.anim.up_from_bottom
                      : R.anim.down_from_top);
      viewHolder.itemView.startAnimation(animation);
      lastPosition = i;
      viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Toast.makeText(v.getContext(), "Title: " + cardViewData.getTitle(), Toast.LENGTH_SHORT).show();
          }
      });
  
  
  }
  
  @Override
  public int getItemCount() {
      return mDataset == null ? 0 : mDataset.size();
  
  }
  
  public static class ViewHolder extends RecyclerView.ViewHolder {
  
      public TextView mTitle;
      public TextView mDescription;
      public ImageView mImage;
  
      public ViewHolder(View itemView) {
          super(itemView);
  
          mTitle = (TextView) itemView.findViewById(R.id.row_title);
          mDescription = (TextView) itemView.findViewById(R.id.row_description);
          mImage = (ImageView) itemView.findViewById(R.id.row_image);
      }
  }
  
  
  }
  </code></pre>