You may be running into a row recycling problem. Here is a sample project where I use RatingBar in a list row -- you should be able to use the same pattern for ToggleButton:
http://github.com/commonsguy/cw-android/tree/master/FancyLists/RateList/ On Tue, Oct 5, 2010 at 11:36 PM, cyberdream <[email protected]> wrote: > Hello, > > Any one knows why my ToggleButtons won't keep their states in a > ListView? > > Each list item includes a ToggleButton - when scrolled off from the > screen their states are reset to unchecked... > > I presume getView() is called once they're visible; however I'm not re > instantiating them anyways... > > Thanks in advance > > ------------------- > > public View getView(int position, View convertView, ViewGroup parent){ > // inflated view here > final ToggleButton saveToggle = > (ToggleButton)view.findViewById(R.id.state_toggle_button); > saveToggle.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > // save or unsave here // > } > }); > return view; > } > > -- > 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 > -- 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.0.1 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

