I have a customlistadapter as follow:
public class CustomListViewAdapter2 extends ArrayAdapter<RowItem> {
List<Integer> baseOnThis;
public CustomListViewAdapter2(Context context, int resourceId,
List<RowItem> items, ArrayList<Integer> ids) {
super(context, resourceId, items);
this.context = context;
baseOnThis= ids;
}
/* private view holder class */
private class ViewHolder {
TextView firstHemistich;
TextView SecondHemistich;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
RowItem rowItem = getItem(position);
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.hemistich_rows, null);
holder = new ViewHolder();
holder.firstHemistich = (TextView) convertView
.findViewById(R.id.title);
holder.SecondHemistich = (TextView) convertView
.findViewById(R.id.desc);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
holder.firstHemistich.setText(rowItem.getTitle());
holder.SecondHemistich.setText(rowItem.getDesc());
return convertView;
}
now I need base on the database value that saved on Arraylist of "baseOnThis" change the color of item of listview but I can't. Is there any idea how should I do this? Please let me know if my question is wrong and don't minus me
Try this
if(position == 3){
holder.SecondHemistich.setTextColor(this.context.getResources().getColor(R.color.color1));
}