title: getView of custom adapter returns wrong Position
body: <p>I have written a custom adapter for a gridview. Each item in grid view has other childs views. One of them is a textView, which has implemented a click listener.</p>
  
  <p>When the user clicks on the TextView, I show a Toast which shows the position of the item in gridView. </p>
  
  <p><strong>Now coming to the problem:</strong></p>
  
  <p>I assign the "position" returned by getView() as a tag to the TextView every time the getView() is called. When I scroll the "position" provided by getView() is the correct value but as soon as the scrolling stops, the position provided by getView() becomes 0, which shouldn't be zero in the first place unless I am at the top of the grid view. However the value saved in the TextView tag is always the correct value. Why is that?</p>
  
  <pre><code>    @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          final ViewHolder viewHolder;
  
          if(convertView == null){
              convertView = mLayoutIflater.inflate(R.layout.grid_item, null);
              viewHolder = new ViewHolder();
  
              …..
              viewHolder.playButton.setOnClickListener(new View.OnClickListener() {
                   @Override
                      public void onClick(View v) {
                           Log.e(“test”, "myPos: "+ (Integer) viewHolder.mTextView.getTag()); // always returns correct position value
  
                          }
                      });
  
              convertView.setTag(viewHolder);
          }
          else
              viewHolder = (ViewHolder) convertView.getTag();
  
  
          Log.e(“test”, "GETVIEW: "+ position); // position is zero when scrolling stops &amp; correct value when scrolling
          viewHolder.mTextView.setTag(position);
  
          return convertView;
      }
  </code></pre>
  
  <p>Best Regards</p>