Example usage for android.preference PreferenceManager setSharedPreferencesMode

List of usage examples for android.preference PreferenceManager setSharedPreferencesMode

Introduction

In this page you can find the example usage for android.preference PreferenceManager setSharedPreferencesMode.

Prototype

public void setSharedPreferencesMode(int sharedPreferencesMode) 

Source Link

Document

Sets the mode of the SharedPreferences file that preferences managed by this will use.

Usage

From source file:org.odk.collect.android.preferences.AdminPreferencesFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);//from   ww w  . j av  a  2 s  .  co m
    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(ADMIN_PREFERENCES);
    prefMgr.setSharedPreferencesMode(MODE_WORLD_READABLE);

    addPreferencesFromResource(R.xml.admin_preferences);

    findPreference(KEY_CHANGE_ADMIN_PASSWORD).setOnPreferenceClickListener(this);
    findPreference(KEY_IMPORT_SETTINGS).setOnPreferenceClickListener(this);
}

From source file:com.twinone.locker.ui.SettingsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mProUtils = new ProUtils(getActivity());
    mPrefUtils = new PrefUtils(getActivity());

    PreferenceManager pm = getPreferenceManager();
    pm.setSharedPreferencesName(PrefUtils.PREF_FILE_DEFAULT);
    pm.setSharedPreferencesMode(Context.MODE_PRIVATE);
    addPreferencesFromResource(R.xml.prefs);

    mPrefs = pm.getSharedPreferences();//from   w ww . ja v  a  2 s  . c  o  m
    mEditor = pm.getSharedPreferences().edit();
    // mShowNotification = (ProCheckBoxPreference)
    // findPreference(getString(R.string.pref_key_show_notification));
    mShortExitTime = (EditTextPreference) findPreference(getString(R.string.pref_key_delay_time));
    mShortExit = (ProCheckBoxPreference) findPreference(getString(R.string.pref_key_delay_status));
    mCatNotif = (PreferenceCategory) findPreference(getString(R.string.pref_key_cat_notification));
    mTransparentPref = (CheckBoxPreference) findPreference(getString(R.string.pref_key_hide_notification_icon));
    mStartWithCall = (ProCheckBoxPreference) findPreference(getString(R.string.pref_key_dial_launch));
    mHideIcon = (ProCheckBoxPreference) findPreference(getString(R.string.pref_key_hide_launcher_icon));
    mChangeLogPref = (Preference) findPreference(getString(R.string.pref_key_changelog));
    mLockTypePref = (Preference) findPreference(getString(R.string.pref_key_lock_type));
    mPrefScreen = (PreferenceScreen) findPreference(getString(R.string.pref_key_screen));
    mCatPassword = (PreferenceCategory) findPreference(getString(R.string.pref_key_cat_password));
    mCatPattern = (PreferenceCategory) findPreference(getString(R.string.pref_key_cat_pattern));
    mRecoveryPref = (Preference) findPreference(getString(R.string.pref_key_recovery_code));
    mBackground = (ProListPreference) findPreference(getString(R.string.pref_key_background));
    mPatternSize = (ProEditTextPreference) findPreference(getString(R.string.pref_key_pattern_size));
    initialize();
}

From source file:com.github.howeyc.slideshow.activities.SettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceManager prefMgr = getPreferenceManager();
    prefMgr.setSharedPreferencesName(AppData.mySettingsFilename);
    prefMgr.setSharedPreferencesMode(MODE_PRIVATE);
    mPrefs = AppData.getSharedPreferences();
    mPrefs.registerOnSharedPreferenceChangeListener(this);

    if (DEBUG)//  w w  w  .  j a  v  a  2s . c o m
        printAllPreferences();
    addPreferencesFromResource(R.xml.settings);
    myCat2 = (PreferenceCategory) findPreference(getString(R.string.sett_key_cat2));

    populateEditableFieldsList();
    populateFieldsToRemove();
    createCat2Fields();
    updateAllFieldTitles();

    // set all missing fields

    //        setCorrectSrcPathField();
    //        updateTitlePrefsWithValues(mPrefs, "all");
    //System.out.println(AppData.toString());
}