Jak zrobić coś, gdy pole wyboru zmienia stan?
To jest mój kod:
<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" />
To, co chcę zrobić, to „wykryć”, gdy jedno z nich jest zaznaczone, a następnie ustawić pozostałe dwa jako „wyłączone”, aby użytkownik mógł wybrać tylko jeden naraz. Próbowałem użyć „.setOnCheckedChangeListener”, ale nie mogę tego zrobić, czy ktoś może mi pomóc z jakimś kodem? Wielkie dzięki!