title: listview select multiple row
body: <p>I am using an <code>ArrayAdapter</code></p>
  
  <pre><code>ArrayAdapter&lt;Product&gt; adapter = new ArrayAdapter&lt;Product&gt;(this,
                  android.R.layout.simple_list_item_1, items);
  listView1.setAdapter(adapter);
  </code></pre>
  
  <p>The problem is when I select first item from <code>listview</code> it select another item automatically. </p>
  
  <p><a href="https://i.stack.imgur.com/j8a3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j8a3X.png" alt="enter image description here"></a></p>
  
  <p>I didn't select item 12</p>
  
  <p><a href="https://i.stack.imgur.com/HNesl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HNesl.png" alt="enter image description here"></a></p>
  
  <p>All code </p>
  
  <pre><code>final ListView listView1 = (ListView) findViewById(R.id.listView);
  
  Product[] items = {
          new Product(1, "Milk", 21.50),
          new Product(2, "Butter", 15.99),
          new Product(3, "Yogurt", 14.90),
          new Product(4, "Toothpaste", 7.99),
          new Product(5, "Ice Cream", 10.00),
          new Product(6, "Milk", 21.50),
          new Product(7, "Butter", 15.99),
          new Product(8, "Yogurt", 14.90),
          new Product(9, "Toothpaste", 7.99),
          new Product(10, "Ice Cream", 10.00),
          new Product(11, "Milk", 21.50),
          new Product(12, "Butter", 15.99),
          new Product(13, "Yogurt", 14.90),
          new Product(14, "Toothpaste", 7.99),
          new Product(15, "Ice Cream", 10.00),
          new Product(16, "Milk", 21.50),
          new Product(17, "Butter", 15.99),
          new Product(18, "Yogurt", 14.90),
          new Product(19, "Toothpaste", 7.99),
          new Product(20, "Ice Cream", 10.00),
  };
  
  ArrayAdapter&lt;Product&gt; adapter = new ArrayAdapter&lt;Product&gt;(this,
              android.R.layout.simple_list_item_1, items);
  
  listView1.setAdapter(adapter);
  
  listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
           String item = ((TextView) view).getText().toString();
           view.setSelected(true);
           listView1.setItemChecked(position, true);
           view.setBackgroundColor(Color.GREEN);
        }
  });
  </code></pre>