D
Deleted User
Guest
Hi,
I have a ListActivity where the list items are defined in another XML layout. The list item layout contains an ImageView, a CheckBox, a TextView and such.
What I want is to set an onClick listener to the CheckBox in each list item. That is easy enough. The trouble is I need that onClick handler to know which position in the list it is.
I'm attaching the listener to the CheckBox after that list item's View has been inflated in getView of my Adapter. The getView method has a position parameter, but I cannot reference it in the onClick handler for my CheckBox. I understand why, but I don't know how to get around it.
How do I accomplish this?
I have a ListActivity where the list items are defined in another XML layout. The list item layout contains an ImageView, a CheckBox, a TextView and such.
What I want is to set an onClick listener to the CheckBox in each list item. That is easy enough. The trouble is I need that onClick handler to know which position in the list it is.
I'm attaching the listener to the CheckBox after that list item's View has been inflated in getView of my Adapter. The getView method has a position parameter, but I cannot reference it in the onClick handler for my CheckBox. I understand why, but I don't know how to get around it.
How do I accomplish this?