This may not be the most elegant or effective solution, but it works for my situation. For some reason, trying to reuse views either from an array of views or using convertView does just about anything, and the beatbox doesn't respond.
The only thing that worked was to create a new view every time getView () was called.
public View getView(final int position, View convertView, ViewGroup parent) { LinearLayout view; view=(LinearLayout)inflater.inflate(R.layout.record_view_start,null); TextView tv=(TextView)view.findViewById(R.id.engName); tv.setText(englishNames[position]); CheckBox cBox=(CheckBox)view.findViewById(R.id.checkBox1); cBox.setChecked(checked[position]); cBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checked[position]=isChecked; } }); return view; }
The search for this solution was also made difficult by the fact that I called a separately defined onCheckedChangedListener, which then determined which CheckBox by id, instead of having a new listener for each CheckBox.
So far, I have not noted this as the correct answer, as I hope that others may have some contribution to the relatively wasteful restructuring of the view each time.
s1ni5t3r
source share