I'm trying to create a preferences page to save user preferences.
Currently I am sat with this in preferences.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="User Preferences">
<CheckBoxPreference
android:title="Save Credentials"
android:defaultValue="true"
android:summary="Save User Login Details"
android:key="credentialsPref" />
</PreferenceCategory>
</PreferenceScreen>
And this in PreferencesActivity.class:
public class PreferencesActivity extends PreferenceActivity {
@SuppressWarnings("deprecation")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.preferences);
}
}
That all works ok but it states that addPreferencesFromResource is deprecated, is there a better way of doing this - I have seen use of PreferenceFragment but it looks like an incredibly long winded way of going about this task, unless I'm mistaken?
(New to Java and programming in general)
Thanks