Android - Change background color of specific item of ListView
<p>I'm making a game which will use a <code>Listview</code> to display some text as a chat.</p>

<p>Some of these texts represents <em>events</em>, so I want to change their background color according to that specific event:
EX. Somebody gets killed, <strong>that specific <code>Listview</code>'s item will have a <em>red</em> background color</strong></p>

<p>How do I achieve this?</p>

<p>This is my JAVA code:</p>

<pre><code>            //STARTING SETUP
        ArrayList&lt;String&gt; arrayListMother;
        ArrayAdapter&lt;String&gt; arrayAdapterMother;
        ListView listViewMother;

        int counter;
        boolean introDone = false;

        String[] night = {"Welcome!","This is Lupus In Tabula!","You're gonna experience the Hasbro Game in a total new way, have fun!"};
        String[] day = {"Thank you!","Great","Let's do it!"};
        String[] dead = {"Thank you!","Great","Let's do it!"};
        String[] saved = {"Thank you!","Great","Let's do it!"};

        Button buttonGo;
        //ENDING SETUP


        //CREATE - CREATE//
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_game);
            setup();

        }
        //CREATE - CREATE//


    public void setup(){

    arrayListMother = new ArrayList&lt;String&gt;();
    arrayAdapterMother = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_1, arrayListMother);
    listViewMother = (ListView) findViewById(R.id.list_mother);
    listViewMother.setAdapter(arrayAdapterMother);
    buttonGo = (Button)findViewById(R.id.buttonGo);
}   
</code></pre>

<p>And this is my XML code:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"&gt;

&lt;ListView
    android:id="@+id/list_mother"
    android:text="@string/go"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:textAppearance="?attr/textAppearanceListItem"
    android:divider="@null"
    android:layout_weight="7"/&gt;

&lt;Button
    android:id="@+id/buttonGo"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:text="@string/go"
    android:textColor="@color/white"
    android:background="@color/colorPrimary"
    android:enabled="true"
    android:onClick="play" /&gt;
&lt;/LinearLayout&gt;
</code></pre>