Example usage for android.preference PreferenceManager setSharedPreferencesName

List of usage examples for android.preference PreferenceManager setSharedPreferencesName

Introduction

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

Prototype

public void setSharedPreferencesName(String sharedPreferencesName) 

Source Link

Document

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

Usage

From source file:io.v.android.debug.DebugLogPreferenceFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final PreferenceManager pm = getPreferenceManager();
    pm.setSharedPreferencesName(VAndroidContext.VANADIUM_OPTIONS_SHARED_PREFS);
    pm.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    createPreferences();//from  w w w  .j  ava2s.c  o m
}

From source file:io.v.baku.toolkit.debug.DebugLogPreferenceFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final PreferenceManager pm = getPreferenceManager();
    pm.setSharedPreferencesName(VAndroidContextTrait.VANADIUM_OPTIONS_SHARED_PREFS);
    pm.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    createPreferences();/*from   www .j  a v a 2  s  . c o  m*/
}

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

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);//from  w w w .j av  a  2  s  .c  o 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 ww  w  .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)/* www. j a va  2  s .  co  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());
}