title: ListView is automatically selecting random items
body: <p>I have a multi-select listview which have 4 textviews and 1 check box in each row. Now, when i select a checkbox and when i scroll down it selects another row randomly. For example if i select 1st item then when i scroll down the first item which comes on screen is selected and vice versa. </p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      final ListView lv= (ListView) findViewById(R.id.lv);
  
      lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
      Downloader d=new Downloader(MainActivity.this,urlAddress,lv);
      d.execute();
  
  }
  </code></pre>
  
  <p>CustomAdapter.java</p>
  
  <pre><code> public class CustomAdapter extends BaseAdapter {
  
   Context c;
   ArrayList&lt;PlayersPool&gt; players;
   LayoutInflater inflater;
   boolean[] itemChecked;
  
   public CustomAdapter(Context c, ArrayList&lt;PlayersPool&gt; players) {
      this.c = c;
      this.players = players;
  
      //INITIALIE
      inflater= (LayoutInflater) 
   c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      itemChecked= new boolean[players.size()];
   }
  
    @Override
    public int getCount() {
      return players.size();
    }
  
    @Override
    public Object getItem(int position) {
      return players.get(position);
    }
  
    @Override
    public long getItemId(int position) {
      return players.get(position).getId();
    }
  
    @Override
    public View getView(final int position, View convertView, ViewGroup 
    parent) {
      if(convertView==null)
      {
          convertView=inflater.inflate(R.layout.model,parent,false);
      }
  
      final TextView nameP= (TextView) 
      convertView.findViewById(R.id.nameP);
      TextView priceP= (TextView) convertView.findViewById(R.id.priceP);
      TextView roleP= (TextView) convertView.findViewById(R.id.roleP);
      TextView team= (TextView)convertView.findViewById(R.id.team_name);
      final CheckBox chk= (CheckBox)convertView.findViewById(R.id.cb);
  
      nameP.setText(players.get(position).getName());
      priceP.setText(players.get(position).getPropellant()+" PKR");
      roleP.setText(players.get(position).getDescription());
      team.setText(players.get(position).getTeamName());
  
  
  
  
          chk.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String listItemText= nameP.getText().toString();
  
              if(chk.isChecked()){
                  Toast.makeText(c,"Checked",Toast.LENGTH_LONG).show();
  
  
  
  
              }
              else
                  Toast.makeText(c,"Not 
       Checked",Toast.LENGTH_LONG).show();
          }
        });
      } 
  </code></pre>
  
  <p>I have tried a lot but i am not able to find out the error.</p>