Well, I have this in my main class: // Build the listview MyAdapter<String> adapter = new MyAdapter<String>(this,android.R.layout.simple_list_item_1, values); // ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, values);
theList.setAdapter(adapter); theList.setOnItemClickListener(new MyOnItemClickListener(this)); // Set the color based upon the string value View rowView; int listCount; View fooView; c.moveToFirst(); listCount = adapter.getCount(); for (int i=0;i<numRows;i++) { rowView = adapter.getView(i, null, theList); ((TextView)rowView).setTextColor(0x64788e); /* if (rowView != null) { if (c.getString(1).equals("foo")) { ((TextView)rowView).setTextColor(0x64788e); } else { ((TextView)rowView).setTextColor(0x7b2325); } } */ c.moveToNext(); } And in my derived adapter, I have this: public class MyAdapter<T> extends ArrayAdapter<T> { public MyAdapter(Context context, int textViewResourceId, T[] objects) { super(context, textViewResourceId, objects); } // context, int, <T>[] @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub TextView rowView; rowView = (TextView) super.getView(position, convertView, parent); ((TextView)rowView).setTextColor(0x64788e); return super.getView(position, convertView, parent); } The result from hacking around is that the list has invisible values. I guess its time to look at your pdf. lol John 2012/1/5 John Davis <davi...@gmail.com>: > Hello Mark, > > Ok. Thanks. I've managed to create my own MyAdapter. I'm guessing, I > need to override the getView routine there now. The code still works > using the custom adapter. It was a struggle ot get the constructor > right. > > I'll look at your pdf in a bit. Let me struggle with the concept of > overriding getView for a bit. > > John > > On Thu, Jan 5, 2012 at 10:26 AM, Mark Murphy <mmur...@commonsware.com> wrote: >> On Thu, Jan 5, 2012 at 10:19 AM, John Davis <davi...@gmail.com> wrote: >>> Ok, I maybe over my head. I guess the first thing to do is subclass >>> array adapter as you said first so I can override its getView call. >> >> Right. Here is a free excerpt from one of my books that goes through >> that process: >> >> http://commonsware.com/Android/excerpt.pdf >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> Warescription: Three Android Books, Plus Updates, One Low Price! >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > -- > John F. Davis > > 独树一帜 -- John F. Davis 独树一帜 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en