SharedPreferences getStringSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SharedPreferences getStringSet method.

This code example shows how to use the following methods:getAll, getStringSet
  @TargetApi(11) 
  @Override 
  public void onSharedPreferenceChanged(SharedPreferences prefs,
                                        String key) {
    Intent i=new Intent(ACTION_SYNC_PREF);
    Object value=prefs.getAll().get(key);
 
    i.putExtra(EXTRA_SENDER, getPackageName());
    i.putExtra(EXTRA_KEY, key);
 
    if (value instanceof Boolean) {
      i.putExtra(EXTRA_VALUE, (Boolean)value);
      i.putExtra(EXTRA_TYPE, TYPE_BOOLEAN);
    } 
    else if (value instanceof Float) {
      i.putExtra(EXTRA_VALUE, (Float)value);
      i.putExtra(EXTRA_TYPE, TYPE_FLOAT);
    } 
    else if (value instanceof Integer) {
      i.putExtra(EXTRA_VALUE, (Integer)value);

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getStringSet
    } 
 
    private Set<String> getList() {
        Set<String> set = new HashSet<String>();
        SharedPreferences prefs = mContext.getSharedPreferences("imsi_list", 0);
        set = prefs.getStringSet("identifiers", null);
        if(set == null)
            return null; 
        Log.v(TAG, set.toString());
        return set;
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getStringSet
		settingsEditor.putStringSet("homecache_set", set);
		settingsEditor.commit();
	} 
 
	public static Set<String> getHomeInfo() {
		return settings.getStringSet("homecache_set", null);
	} 
 
	public static void saveHomeInfoCounter(int counter) {
		settingsEditor.putInt("homecache_counter", counter);
		commit(); 
	} 
 
	public static int getHomeInfoCounter() { 
		return settings.getInt("homecache_counter", 0);
	} 
 
	public static boolean getCrashReportsEnabled() { 
		return settings.getBoolean("report_preference", true);
	} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getStringSet
	/** 
	 * {@inheritDoc} 
	 */ 
	@Override 
	public Set<String> getStringSet(final String arg0, final Set<String> arg1) {
		return preferences.getStringSet(arg0, arg1);
	} 
 
	/** 
	 * This returns the city id associated with the app widget. 
	 *  
	 * @param appWidgetId 
	 * @return 
	 */ 
	public long getWidgetCityId(final long appWidgetId) {
		return preferences.getLong(WIDGET_CITY_ID_PREFERENCE_KEY_PREFIX
				+ appWidgetId, DEFAULT_CITY_ID);
	} 
 
	/** 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getStringSet
    public void setRecovery(String value) {
        savePreference(PROPERTY_RECOVERY, value);
    } 
 
    public boolean isShowOption(String option) {
        Set<String> opts = settings.getStringSet(PROPERTY_SHOW_OPTIONS, DEFAULT_SHOW_OPTIONS);
        return opts.contains(option);
    } 
 
    public Set<String> getShowOptions() {
        return settings.getStringSet(PROPERTY_SHOW_OPTIONS, DEFAULT_SHOW_OPTIONS);
    } 
 
    public void setShowOptions(String options) {
        savePreference(PROPERTY_SHOW_OPTIONS, options);
    } 
 
    public String getDownloadPath() {
        return settings.getString(PROPERTY_DOWNLOAD_PATH, DEFAULT_DOWNLOAD_PATH);
    } 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related SharedPreferences getStringSet Questions & Answers:

getStringSet Method Overview
Retrieve a set of String values from the preferences.
See Code Examples for other Android SharedPreferences Methods: