I've been trying to override getView()
in the adapter for a listview to set attributes for views within the layout:
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if (convertView == null)
vi = inflater.inflate(R.layout.guest_list_row, null);
TextView name = (TextView) vi.findViewById(R.id.GuestName);
Button RSVPIndicator = (Button) vi.findViewById(R.id.RSVPState);
Invites invite = data.get(position);
name.setText(nameContact(invite.getUserID()));
int RSVPState = invite.getAttending();
if (RSVPState == 1) {
RSVPIndicator.setBackgroundColor(color.GuestAccepted);
}
if (RSVPState == 0) {
RSVPIndicator.setBackgroundColor(color.GuestDeclined);
}
return vi;
}
Unfortunately the set methods I am calling on the view components seem to do nothing. The background color does change for the RSVPIndicator however not the color I have specified.
I've tried a lot of different values to set the views with no luck. Is there something trivial I am missing?
Thanks for any help.