public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) {
row = LayoutInflater.from(context).inflate(R.layout.list_row_item, null);
Integer colorRes;
ListItem item = getItem(position);
switch (item.getType()) {
default:
case ListColors.RED:
colorRes = context.getResources().getColor(R.id.red);
break;
case ListColors.GREEN:
colorRes = context.getResources().getColor(R.id.green);
break;
case ListColors.BLUE:
colorRes = context.getResources().getColor(R.id.blue);
break;
case ListColors.YELLOW:
colorRes = context.getResources().getColor(R.id.yellow);
break;
case ListColors.PURPLE:
colorRes = context.getResources().getColor(R.id.purple);
break;
}
layout.setBackgroundColor(colorRes);
}
return row;
}