title: Overriding Android ArrayAdapter
body: <p>I want to do a very simple thing. I have a listview in my application which I dynamically add text to. But, after a certain point, I would like to change the color of the text inside the listview. So, I made a XML defining my custom list item, and subclassed the ArrayAdapter. But, whenever I call the add() method on my custom ArrayAdapter, an item does get added to the listview, but the text is not placed into it. </p>
  
  <p>Here's my XML: `</p>
  
  <pre><code>&lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_content" android:textSize="8pt"
      android:gravity="center" android:layout_margin="4dip"
      android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FF00FF00"/&gt;
  </code></pre>
  
  <p>And my ArrayAdapter subclass:</p>
  
  <pre><code>private class customAdapter extends ArrayAdapter&lt;String&gt; {
      public View v;
      public customAdapter(Context context){  
          super(context, R.layout.gamelistitem);
      }
  
      @Override
      public View getView(int pos, View convertView, ViewGroup parent){
          this.v = convertView;
          if(v==null) {
              LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              v=vi.inflate(R.layout.gamelistitem, null);
          }
  
          if(timeLeft!=0) {
              TextView tv = (TextView)v.findViewById(R.id.list_content);
              //tv.setText(str[pos]);
              tv.setTextColor(Color.GREEN);
          }
          else {
              TextView tv = (TextView)v.findViewById(R.id.list_content);
              //tv.setText(str[pos]);
              tv.setTextColor(Color.RED);
          }
  
          return v;
      }
  }
  </code></pre>
  
  <p>I'm sure I'm doing something horribly wrong, but I'm still a little new to Android.</p>
  
  <p>Thank you!
  `</p>