I have defined a task, which is just the a checkbox and a text together.
I also have a ListView of tasks that show correctly.
The problem is, when I scroll the list or when I try to add a new element to my list, all the checkboxes uncheck, but the text stays the same.
Here's what I have for getView in my TaskAdapter :
public View getView(int position, View convertView, ViewGroup parent) {
Task task = getItem(position);
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(layoutID, parent, false);
TextView textView = (TextView) convertView.findViewById(R.id.description);
CheckBox checkBox = (CheckBox) convertView.findViewById(R.id.box);
textView.setText(task.getDescription());
checkBox.setActivated(task.getBox());
return convertView;
}
Thanks in advance for any help :D
Aucun commentaire:
Enregistrer un commentaire