I’m trying to implement clearing all the check marks of check boxes on single button click, code seems okay for me but it isn’t working. Checkboxes is in different layout…in my present activity I’m inflating the checkboxes and doing setChecked(false)(which is not working)..is there any another way?
Button clearbtn1 = (Button) findViewById(R.id.clearbtn);
clearbtn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater_example = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v1= inflater_example.inflate(R.layout.profile, null);
CheckBox checkBox = (CheckBox) v1.findViewById(R.id.checkBox1);
checkBox.setChecked(false);
}
});
Any help would be appreciated.
your adapter has these views that you want to effect. standard OOP principles dictate that you make adapter methods to go about it. judging from your adapter technique and how it deftly combats
convertViewto persist checkbox states, i’d think the method would be self-evident. simply set thebooleanflags that determine their states and refresh the adapter. here’s a sample adapter method, that you can call from the button’sOnClickListener