-
Notifications
You must be signed in to change notification settings - Fork 0
ProfileSettings
The layout resource file (preferences.xml) is not located in the layout folder but inside de xml folder.
To add new elements manually choose one of the standard options or use one of the custom elements. Custom element classes are located at Activities/Mainscreen/Customsettings
(SettingsAdapter is not part of the custom elements, this adapter is used to fill the poi list in the fragment_routesettings layout).
Example of adding a custom element inside preferences.xml:
<com.dp16.runamicghent.Activities.MainScreen.CustomSettings.CustomCbPref
android:key="pref_key_dynamic_heart_routing_on_off"
android:title="@string/pref_title_dynamic_routing_on_off"
android:summaryOff="@string/pref_summary_off_dynamic_routing_on_off"
android:summaryOn="@string/pref_summary_on_dynamic_routing_on_off"
android:textAppearance="?android:attr/textAppearanceSmall"
android:defaultValue="true"/>
In the first line you see it's a reference of the class CustomCbPref
and that the class is located in the CustomSettings folder.
This layout uses a technique called PreferenceScreen.
These settings are stored automatically. The reference string it uses to store these settings is the "key" attribute of the element.
The previous example shows a key attribute:
android:key="pref_key_avgspeed_routing_on_off"
To receive these preferences you need to make an variable of SharedPreferences
.
You can find more information on how to receive stored preferences here.