oncheckedchanged

How to do something when a checkbox change state?

[亡魂溺海] 提交于 2019-11-26 23:34:57
问题 This is my code: <CheckBox android:id="@+id/sprint_checkbox" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/sprint_game" /> <CheckBox android:id="@+id/marathon_checkbox" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/marathon" /> <CheckBox android:id="@+id/never_ending_checkbox" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/never_ending" /> What i want

onCheckedChanged called automatically

泪湿孤枕 提交于 2019-11-26 15:36:48
问题 I have a switch in a recyclerview and data is displayed in the recyclerview after retrieving data from DB. When the recyclerview is opened I read DB and if a field in DB is "Y" I enable the switch or else I disable the switch. Now the problem is along with it the onCheckedchanged listener is also called, I want the onCheckedChanged to be called only when user sets the switch manually. On opening the recyclerview below is executed: holder.enabledisable.setChecked(messengerRecord.get_is_valid()