Here is an example of the the simplest way I have found to do this type of thing.
public class IconCursorAdapter extends SimpleCursorAdapter { IconCursorAdapter(Context context, int layout, Cursor cursor,String[] from, int[] to) { super(context, layout, cursor, from, to); this.setViewBinder(new IconViewBinder()); } } public class IconViewBinder implements SimpleCursorAdapter.ViewBinder { public boolean setViewValue(View view, Cursor cursor, int columnIndex) { if (view instanceof TextView) { ((TextView) view).setText(cursor.getString(columnIndex)); return true; } if (view instanceof ImageView) { String listType = cursor.getString(columnIndex); if (listType.equals("wish_list")) { ((ImageView) view).setImageResource(R.drawable.lander_plain); return true; } if (listType.equals("todo_list")) { ((ImageView) view).setImageResource(R.drawable.lander_firing); } else { ((ImageView) view).setImageResource(R.drawable.lander_crashed); } return true; } return false; } } On Mar 17, 11:57 pm, Markiv <vikramshe...@gmail.com> wrote: > I have table with 3 columns which is binded to an XML document with > three text views. > > String[] from = new String[]{A,B,C}; > > int [] to = new int[] {R.id.a,R.id.b,R.id.c}; > > Where R.id.a, R.id.b, R.id.c -> TextView > > Depending on the value store in the third column, I want to change the > text color in R.id.c > > How should, I go about with this. > > This is what I have so far : > > SimpleCursorAdapter entry = new SimpleCursorAdapter(this, > R.layout.addrow, vCursor , from , to); > > setListAdapter(entry); > > If you can provide me an example, that would be really helpful. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---