Where are the settings of a preferences screen stored?

rekire picture rekire · Jun 25, 2013 · Viewed 9.7k times · Source

I know this question is a little stupid but I cannot find where the settings of my preferences screen are stored.

I am using shared preferences this file is located at /data/data/my.package.name/shared_prefs/common.xml. However when I change something the changes are stored. I even implemented custom controls which can store their information so far. But however I cannot figure out where the settings are stored. /data/data/my.package.name/ is only one xml file which does not contain any related information. I also checked the virtual directories for multi user devices with no luck.

Here is my xml:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res/my.package.name"
    android:persistent="true" >

    <PreferenceCategory android:title="@string/settings_basics_group" >
        <EditTextPreference
            android:key="nickname"
            android:persistent="true"
            android:positiveButtonText="@string/setting_change_name"
            android:title="@string/settings_username" />
        <my.package.name.controls.EmailPreference
            android:key="mail"
            android:title="@string/settings_email"
            custom:domains="@array/known_email_domains" />
        <Preference
            android:summary="Mars"
            android:title="@string/settings_current_location" />
        <my.package.name.controls.DatePreference
            android:key="birthday"
            android:title="@string/settings_birthday" />
    </PreferenceCategory>
</PreferenceScreen>

I would be really happy if somebody could explain me where these settings are stored.

Answer

Dalmas picture Dalmas · Jun 25, 2013

The app preferences are stored in the default shared preferences that you can retrieve with PreferenceManager.getDefaultSharedPreferences().

The XML file itself is located at /data/data/YOUR_PACKAGE_NAME/shared_prefs/YOUR_PACKAGE_NAME_preferences.xml