On Sun, Jul 10, 2011 at 2:29 PM, Simon Platten <[email protected]> wrote: > Obviously I'm missing something, it seems to me that the list view doesn't > work off the actual array but takes copies of the data when the getView is > called, when these are edited the differences are lost when the item goes > off view. I've tried modifying the getView to reference the array directly, > but with little success.
You indicated that your ListView rows have a CheckBox. CheckBox widgets have an OnCheckedChangedListener that you can set. OnCheckedChangedListener tells you when the CheckBox is checked or unchecked. Therefore, by setting the OnCheckedChangedListener, your code can find out when a CheckBox is checked or unchecked, and store the checked state somewhere, such as in the associated array entry. That way, you have the correct state in getView(). While the following project demonstrates a RatingBar rather than a CheckBox, the concept still holds: https://github.com/commonsguy/cw-android/tree/master/FancyLists/RateList The following free excerpt from one of my books covers this and other topics related to custom adapters: http://commonsware.com/Android/excerpt.pdf (see the "Interactive Rows" section for the RatingBar sample) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 3.5 Available! -- 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

