how to change the background color of a listview when clicked once and when clicked again i need to change the background color without using selector
<p>how to change the background color of a listview when clicked once and when clicked again i need to change the background color without using selector.I have worked on changing the background when i select each item.but when i click again on the item i need to change the background color as red.how can i give the condition.i will post my code here.please give suggestions.please help...</p>

<p>public class ProvierActivity extends Activity {</p>

<pre><code>private String text[] = { "BroadStripe-Cable (Seattle)",
        "BroadStripe-Digital (Seattle)", "BroadStripe-Cable (Seattle)",
        "Comcast king county south)", "BroadStripe-Cable (Seattle)",
        "Comcast king county south", "BroadStripe-Digital (Seattle)",
        "BroadStripe-Digital (Seattle)", "BroadStripe-Cable (Seattle)",
        "Comcast king county south" };

ImageView icon;
public static int selectedRow;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final ListView list = (ListView) findViewById(R.id.listview_id);

    list.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list,
            R.id.title, text));
    list.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView&lt;?&gt; adapter, View view,
                int position, long arg3) {

            for (int i = 0; i &lt; adapter.getChildCount(); i++) {
                if (i == position) {

                    adapter.getChildAt(i).setBackgroundColor(Color.BLUE);

                } else {
                    adapter.getChildAt(i).setBackgroundColor(Color.BLACK);

                }

            }

        }

    });
}
</code></pre>

<p>}</p>
