title: Android : Alternate colors in ListView using ArrayAdapter
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10479108/how-can-i-set-differnt-background-color-for-each-row-in-listview">How can i set differnt background color for each row in listview?</a>  </p>
  </blockquote>
  
  
  
  <p>How can i add different/alretnate colors for listview items? The below is my code to add items to ListView using ArrayAdapter</p>
  
  <pre><code>list  = (ListView)findViewById(R.id.planetList);
  adapter = new ArrayAdapter&lt;String&gt;(MyListViewActivity.this, R.layout.my_list_row, R.id.planetNameTextView);
  
  for (int i = 0; i &lt; planetNamesArray.length; i++) {
  adapter.add(planetNamesArray[i]);
  }
  list.setAdapter(adapter);
  </code></pre>
  
  <p>Can anyone guide me to add the different background colors using ArrayAdapter as i'am a newbie to android </p>