Hi guys I'm trying to set an OnCheckedChangeListener on a checkbox.
Here the code of the checkbox:
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:text="" />
Here the code of the event listener:
checkbox_task.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
adapter.notifyDataSetChanged();
}
});
The checkbox is in a different layout than the main xml but I think I take it in the correct way:
taskView = getActivity().getLayoutInflater().inflate(R.layout.item_todo, null);
checkbox_task = (CheckBox) taskView.findViewById(R.id.checkBox1);
The strange thing is that the application does not crash and also the debug does not never pass through setOnChangeListener and i don't know why.
Someone can help me? Thank you all
Aucun commentaire:
Enregistrer un commentaire