Reputation: 1602
Im trying to listen when the checkbox is checked or not.
Problem
onCheckedListener
is never called
What have i tried
XML
<CheckBox
android:onCheckedChanged="@{(v, checked) -> handler.onCheckedChanged(checked)}"
...
/>
<variable
name="handler"
type="com.example.tiago.demo.Search.Adapter.Adapter"/>
Adapter.java (com.example.tiago.demo.Search.Adapter
)
public void onCheckedChanged(boolean isCheck){
Log.d("adapter","Is checked: ".concat(String.valueOf(isCheck)));
}
I read similar posts about this on forums and in here, but none of them work for me, this one is the only one that lets me compile with no problems, but when i click on the checkbox i don't get any log message.
Notes
android:onCheckedChanged
unknown attribute (all the examples that i see use onCheckedChanged
not sure why im getting this message)onCheckedChanged
color is yellow the only place i call this is from xmlUpvotes: 1
Views: 3687
Reputation: 1602
I was able to fix my issue, i was not binding the variable silly mistake
Upvotes: 1