I have checkboxpreference in preference activity and I want that when one of the checkbox is enabled then other checkbox should get to disable and vice versa. I wants to do that from my main class activity.
Here is my code:
Preferencecheckbox.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:defaultValue="true"
android:icon="@drawable/img"
android:key="check1"
android:title="first" />
<CheckBoxPreference
android:defaultValue="false"
android:icon="@drawable/img2"
android:key="check2"
android:title="second" />
</PreferenceScreen>
Preferenceclass.java
public class preferenceclass extends PreferenceActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferencecheckbox);
}