title: Android ListView Row color change issue on scroll
body: <p>I am listing installed apps in listview with CheckBox, I am selecting any item and send it for scan, after scan i am trying to change that row color which changed correctly, but when I scroll listview that color changed on many rows below, i want to change only that position not change on scroll other rows.</p>
  
  <p>Where I am change row color in Activity.</p>
  
  <pre><code>String[] separated = result.split(":");
          int position = Integer.parseInt(separated[1]);
          if (separated[0].equals("R")) {
              View v = listView.getChildAt(position);
              v.setBackgroundColor(Color.RED);
          } else {
              View v = listView.getChildAt(position);
              v.setBackgroundColor(Color.GREEN);
          }
  </code></pre>
  
  <p>My BaseAdapter </p>
  
  <pre><code>public class Installedapps extends BaseAdapter {
  
  public List&lt;CustomObject&gt; list;
  CustomObject object2;
  boolean[] itemChecked;
  Activity context;
  
  public Installedapps(Activity context, List&lt;CustomObject&gt; arg1) {
      super();
      this.context = context;
      list = arg1;
      itemChecked = new boolean[list.size()];
      object2 = new CustomObject();
  }
  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      return list.size();
  }
  
  @Override
  public CustomObject getItem(int position) {
      // TODO Auto-generated method stub
      return list.get(position);
  }
  
  @Override
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  public void remove(int position) {
      list.remove(position);
  
  }
  
  @Override
  public View getView(final int position, View convertView,
          ViewGroup parent) {
      final ViewHolder holder;
      final CustomObject object = getItem(position);
      if (convertView == null) {
          holder = new ViewHolder();
  
          // TODO Auto-generated method stub
          LayoutInflater inflater = context.getLayoutInflater();
          convertView = inflater.inflate(R.layout.adapter_installed_apps,
                  parent, false);
  
          holder.im = (ImageView) convertView
                  .findViewById(R.id.allapps_image);
          holder.checkBox = (CheckBox) convertView
                  .findViewById(R.id.btn_scan_allapps);
          holder.checkBox.setChecked(false);
          holder.md5 = (TextView)convertView.findViewById(R.id.md5TXT);
          holder.name = (TextView) convertView
                  .findViewById(R.id.allapps_pacagename);
          convertView.setTag(holder);
  
      } else {
  
          holder = (ViewHolder) convertView.getTag();
      }
  
      final ApplicationInfo into = PackageUtil.getPackagePath(
              context, object.Aplicationname);
  
      String pacage = object.Aplicationname;
      String name = (String) into.loadLabel(context.getPackageManager());
      Drawable ICON = into.loadIcon(context.getPackageManager());         
      final File file = new File(into.publicSourceDir);
      holder.im.setImageDrawable(ICON);
      holder.name.setText(name);
      holder.md5.setText(file.toString());
  
      if (itemChecked[position])
             holder.checkBox.setChecked(true);
            else
             holder.checkBox.setChecked(false);
  
            holder.checkBox.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
              // TODO Auto-generated method stub
              if (holder.checkBox.isChecked()){
               itemChecked[position] = true;
               DetailMessageModel.getInstance().changeState(
                       file.toString() + ":" + Integer.toString(position)
                          );
              }
              else{
               itemChecked[position] = false;
               RemoveItemModel.getInstance().changeState(
                       file.toString() + ":" + Integer.toString(position)
                          );
              }
             }
            });
  
      return convertView;
  }
  }
  
  class ViewHolder {
  CheckBox checkBox;
  TextView name, md5;
  ImageView im;
  
  }
  </code></pre>