I have a SettingsActivity ( extends PreferenceActivity ) , which is loaded from a preferences.xml file(res–>xml–>preferences.xml).
The preferences.xml is this:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceCategory android:title="Patient's Settings" >
<EditTextPreference
android:defaultValue="Not Set"
android:key="patientMobile"
android:title="mobile number" />
</PreferenceCategory>
<PreferenceCategory android:title="Doctor's Settings" >
<EditTextPreference
android:defaultValue="Not Set"
android:key="docEmail"
android:title="e-mail" />
<EditTextPreference
android:defaultValue="Not Set"
android:key="docMobile"
android:title="mobile number" />
</PreferenceCategory>
<PreferenceCategory android:title="Application Settings" >
<SwitchPreference
android:disableDependentsState="false"
android:enabled="true"
android:key="lang"
android:summaryOff="English"
android:summaryOn="Greek"
android:switchTextOff="EN"
android:switchTextOn="GR" />
</PreferenceCategory>
How i can set/update/overwrite these values from another activity?
I retreive information from a webservice and then i want to save these values and then to be seen from SettingsActivity:
1.patientMobile (string)
2.docEmail (string)
3.docMobile (string)
You can read/set/update these values using
SharedPreferencesand the key to the preference.