Ok so far I have created this, and my items are being displayed. Lets suppose that I am having the key values in an array with as many elements as the rows. If I have 16 rows, then my array has 16 elements. I want to check the array[0] and depending on the value setColor to first row, then check array[1] and setColor to next row and so on. Can anyone help me:
public class SimpleAdapter extends ArrayAdapter<String>{
private final Context context;
private String data[] = null;
public SimpleAdapter(Context context, String[] data) {
super(context, R.layout.row, data);
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.row, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.text1);
textView.setText(data[position]);
return rowView;
}
}