I set up the data binding in xml but when i go to the preference activity to actually set up the binding i cant. The file where the data binding xml is in is called preference.xml so i assume there should be a generated class called PreferencesBinding but instead there is not. Should it not be auto generated ? Also my code in preferenceActivity.java wont compile the following:
Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferencesBinding binding = DataBindingUtil..... //what do put here ??? this is preferenceactivity not Activity
Admin user = new Admin(true);
binding.setUser(user);//this what i want to do
addPreferencesFromResource(R.xml.preferences);//this would not be necessary if i can get dataBinding to work
//..rest of code not important
}
i am starting to think data binding does not work for preference screens, can anyone help ?
the preferences.xml file if neseccary looks like this:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customNS="http://schemas.android.com/apk/res/mypackage"
>
<data>
<variable name="admin" type="mypackage.Administration"/>
</data>
<PreferenceScreen>
<!-- ....bunch of preferences ... -->
</PreferenceScreen>
</layout