0

I want to change the color of a TextView inside my Activitys ListView by java code. ListView contains multiple rows which are fed by a MatrixCursor and an ArrayAdapter. The color of the TextView should be green or white which should be determined by an if clause. How can I accomplish this?

    citem = NameManager.getciList();
    NameManager.WriteName(citem);
    MatrixCursor cursor;
    cursor = NameManager.getnameList();
    startManagingCursor(cursor);
    if (cursor.getString(9).equals("yes")){
        //TODO set color of R.id.name color here
    }
    String[] from = { "name", "info", "status", "path", "folder", BaseColumns._ID };
    int[] to = { R.id.name, R.id.info, R.id.status, R.id.path };
    final SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
            R.layout.row, cursor, from, to);
    setListAdapter(adapter);
Binoy Babu
  • 16,699
  • 17
  • 91
  • 134

1 Answers1

0

write your own custom adapter, where you can set color, size of list items.see this link it will let u know an idea. below is lis with blue text color

r

Community
  • 1
  • 1
AAnkit
  • 27,299
  • 12
  • 60
  • 71