Hi Jon... thanks for the reply. Thought you might have been onto something
there, as in fact I wasn't storing the ArrayList that was passed into the
ShoppingListAdapter constructor at all -- I was just directly accessing the
one in the parent class, as you said, although that does appear to be a not
uncommon design pattern in the examples I'd been looking at. So now my
constructor looks like:
public class ShoppingListAdapter extends ArrayAdapter<ShoppingListItem>{
private ArrayList<ShoppingListItem> itemList;
public ShoppingListAdapter(Context c, int layoutId,
ArrayList<ShoppingListItem> itemList){
super(c, layoutId, itemList);
this.itemList = itemList;
}
Unfortunately, having rectified that, and tried replacing the lines you
suggested with both:
rowView.setText(itemList.get(position).getName());
rowView.setChecked(itemList.get(position).isChecked());
and
rowView.setText(getItem(position).getName());
rowView.setChecked(getItem(position).isChecked());
the behavior appears to be exactly the same as my original version. (Your
suggestion doesn't work verbatim, as getItem is not defined on itemList).
I guessed the checkbox issue might be something to do with view recycling
too, but I've tried both working with the recycled convertView when
available, and just inflating a new view every time regardless, and that
doesn't seem to make any difference either...
Cheers,
Calum.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en