I am having problems downloading PreferenceFragmentin Android. This is really a basic implementation at the moment, which I want to expand later when it works.
The problem is that after going to SettingsFragmentonly the first preference is shown.
I am not getting any errors, but logcat shows me this:
W/PathParser: Points are too far apart 4.000000596046461
I was looking for this, but without any useful solutions.
The code is as follows:
MainActivity navigation through NavigationDrawer
navigate() is a common function using FragmentManager
case R.id.nav_settings:
navigate(new SettingsFragment(), "settingsFragment", false);
break;
SettingsFragment
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
public SettingsFragment() { }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
@Override
public void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) { }
}
prefences.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:key="switch_notifications"
android:title="Notifications"
android:summary="Receive notifications"
android:defaultValue="true" >
</SwitchPreference>
<CheckBoxPreference
android:key="switch_notifications2"
android:title="Notifications"
android:summary="Receive notifications"
android:defaultValue="true" >
</CheckBoxPreference>
</PreferenceScreen>
Screenshots
Left: actual output | Right: Preview

Thanks in advance!
Niels