title: Listview Images gets shuffled when scrolled from top to bottom
body: <p>I have a custom list view adapter, and when I scroll down/up the list, images get shuffled and I don't know what to do. How to solve this problem?</p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
      DataModel dataModel = getItem(position);
      ViewHolder viewHolder;
      if (convertView == null) {
  
        convertView=LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false);
  
          viewHolder = new ViewHolder();
          viewHolder.letter = convertView.findViewById(R.id.tvFirstt);
          viewHolder.name = convertView.findViewById(R.id.nameview);
          viewHolder.contact =convertView.findViewById(R.id.contactview);
          viewHolder.profileimg=convertView.findViewById(R.id.profileimg);
          viewHolder.chkSelect = convertView.findViewById(R.id.checkbox);
          viewHolder.detail = convertView.findViewById(R.id.detail);
      } else {
          viewHolder = (ViewHolder) convertView.getTag();
  
      }
  
  
          viewHolder.name.setText(dataModel.fname + " " + dataModel.lname);
          viewHolder.contact.setText(dataModel.landline);
          viewHolder.detail.setImageResource(R.drawable.right);
          viewHolder.chkSelect.setTag(position);
          viewHolder.chkSelect.setChecked(dataModel.isChecked);
  
          viewHolder.chkSelect.setOnCheckedChangeListener(this);
          if (dataModel.image == null) {
              viewHolder.letter.setVisibility(View.VISIBLE);
              viewHolder.letter.setText(dataModel.fname.substring(0, 1));
          } else {
              viewHolder.profileimg.setVisibility(View.VISIBLE);
              viewHolder.profileimg.setImageBitmap(convertToBitmap(dataModel.image));
          }
  
      } else {
          Log.e("Error", "Please see again");
      }
  
      convertView.setTag(viewHolder);
      return convertView;
  }
  </code></pre>