Hello jagi,
we also realized that. The first problem CheckBox is a View itself which consumes the Clicks and there for no ClickEvent is passed "down" to the onListItemClick() of the ListActivity. The second problem is that when you click the CheckBox it just looks like it got clicked (if you would try to get the State it would be the default you created it with) and if you scroll out once it gets "forgotten" and when it comes back a new checkbox-View is created with the default value.
This is a
half-fix to the first Problem, it works fine with me:
Alter your
Activity similar to this:
Using java Syntax Highlighting
CheckBoxifiedTextListAdapter ctla;
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
ctla.toggleChecked(position);
super.onListItemClick(l, v, position, id);
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
this.setContentView(R.layout.main);
ctla = new CheckBoxifiedTextListAdapter(this);
// ....
Parsed in 0.033 seconds, using
GeSHi 1.0.8.4
In
CheckboxifiedTextListAdapter add:
Using java Syntax Highlighting
public void toggleChecked(int position) {
this.mItems.get(position).toggleChecked();
}
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4
In
CheckboxifiedText add:
Using java Syntax Highlighting
public void toggleChecked() {
this.mChecked = !this.mChecked;
}
Parsed in 0.034 seconds, using
GeSHi 1.0.8.4
Regards,
plusminus