title: Images in gridview change their position on scrolling in android
body: <p>I am trying to fill my <code>Gridview</code> with some <code>TextViews</code> and <code>Imageviews</code>. I did it successfully, but when I scroll down in the grid, the images change their postion. I have read some other questions related to the same issue; like this one <a href="https://stackoverflow.com/questions/6055730/gridview-elements-changes-their-place-dynamically-when-scroll-screen">question</a>, but it did not help me. </p>
  
  <p><strong>Aadapter</strong></p>
  
  <pre><code>public class ItemListBaseAdapter extends BaseAdapter {
  
  private static ArrayList&lt;ItemDetails&gt; itemDetailsrrayList;
  
  private LayoutInflater l_Inflater;
  
  private Context context;
  
  // private OnClickListener listner;
  
  public ItemListBaseAdapter(Context context, ArrayList&lt;ItemDetails&gt; results) {
      itemDetailsrrayList = results;
      l_Inflater = LayoutInflater.from(context);
      this.context = context;
  }
  
  public int getCount() {
      return itemDetailsrrayList.size();
  }
  
  public Object getItem(int position) {
      return itemDetailsrrayList.get(position);
  }
  
  public long getItemId(int position) {
      return position;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
          convertView = l_Inflater.inflate(R.layout.activity_gridview_items,
                  null);
      holder = new ViewHolder();
      convertView.setTag(holder);
      } else {
          holder = (ViewHolder) convertView.getTag();
      }       
  
      holder.txt_itemName = (TextView) convertView
              .findViewById(R.id.tv_item_title);
      holder.txt_itemDescription = (TextView) convertView
              .findViewById(R.id.tv_item_detail);
      holder.txt_itemPrice = (TextView) convertView
              .findViewById(R.id.tv_item_price);
      holder.itemImage = (ImageView) convertView
              .findViewById(R.id.iv_item_image);
      holder.txt_itemName
              .setText(itemDetailsrrayList.get(position).getName());
      holder.txt_itemDescription.setText(itemDetailsrrayList.get(position)
              .getItemDescription());
      holder.txt_itemPrice.setText("Rs "
              + itemDetailsrrayList.get(position).getPrice());
       holder.itemImage.setImageBitmap(itemDetailsrrayList.get(position)
       .getImage());
  
      return convertView;
  }
  
  static class ViewHolder {
      TextView txt_itemName;
      TextView txt_itemDescription;
      TextView txt_itemPrice;
      ImageView itemImage;
      Button likeBtn;
      Button addBtn;
    }
  }
  </code></pre>