I\'m trying to change the row color of my listView in customAdapter. There\'s an array of integer that include 0 and 1, I\'m trying to read from the array and change the color o
Fast solution (not very nice code, but works):
@Override
public int getItem(int position){
return test.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int color0 = ....
int color1 = ....
int colorDefault = ...
switch (test.get(position)) {
case 0:
convretview.setBackgroundColor(color0);
break;
case 1:
convretview.setBackgroundColor(color1);
break;
default:
convretview.setBackgroundColor(colorDefault);
}
...
}