Don't use a SimpleAdapter
. Create a custom adapter that overrides getView
and make whatever manipulations that you want to the text color based on the current item's text.
The logic will be simpler and clearer than trying to go through the list afterwards.
See /samples/android-8/ApiDemos/src/com/example/android/apis/view/List5.java
in your Android SDK folder (download appropriate samples as necessary) for a simple example:
private class MyListAdapter extends BaseAdapter {
...
public View getView(int position, View convertView, ViewGroup parent) {
TextView tv;
if (convertView == null) {
tv = (TextView) LayoutInflater.from(mContext).inflate(
android.R.layout.simple_expandable_list_item_1, parent, false);
} else {
tv = (TextView) convertView;
}
tv.setText(mStrings[position]);
return tv;
}
...
}