SharedPreferences getFloat - 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 getFloat method.

This code example shows how to use the following methods:getFloat
		return sharedPrefs.getLong(key, defValue);
	} 
 
	@Override 
	public float getFloat (String key, float defValue) {
		return sharedPrefs.getFloat(key, defValue);
	} 
 
	@Override 
	public String getString (String key, String defValue) {
		return sharedPrefs.getString(key, defValue);
	} 
 
	@Override 
	public Map<String, ?> get () {
		return sharedPrefs.getAll();
	} 
 
	@Override 
	public boolean contains (String key) {
7
CodeRank
This code example shows how to use the following methods:getBoolean, getFloat
    	loc.setAccuracy(settings.getFloat("LastLocAccuracy", 100000));
    	return loc;
    } 
     
    public Location getHomeLocation() {
    	if(!settings.getBoolean("haveHomeLocation", false))
    		return null; 
    	 
    	Location loc = new Location("Home");
    	loc.setLatitude(settings.getFloat("HomeLocLat", (float)40.443181));  // Easter Egg: default value
    	loc.setLongitude(settings.getFloat("HomeLocLong", (float)-79.943060));
    	loc.setAccuracy(settings.getFloat("HomeLocAccuracy", 100000));
    	return loc;
    } 
     
    // Higher level settings 
    public int getClientID() { return settings.getInt("randClientID",-1); }
    public void setClientID(int id) { sEditor.putInt("randClientID", id); sEditor.commit(); }
    public String getHomeSSID() { return settings.getString("homeSSID", null); }
    public void setHomeSSID(String ssid) { sEditor.putString("homeSSID", ssid); sEditor.commit(); }
6
CodeRank
This code example shows how to use the following methods:getBoolean, getFloat, getString
7
CodeRank
This code example shows how to use the following methods:contains, getFloat
        } 
    } 
 
    @Override 
    public float getFloat(String key, float defValue) {
        if (isGlobal(key) || !mPrefLocal.contains(key)) {
            return mPrefGlobal.getFloat(key, defValue);
        } else { 
            return mPrefLocal.getFloat(key, defValue);
        } 
    } 
 
    @Override 
    public boolean getBoolean(String key, boolean defValue) {
        if (isGlobal(key) || !mPrefLocal.contains(key)) {
            return mPrefGlobal.getBoolean(key, defValue);
        } else { 
            return mPrefLocal.getBoolean(key, defValue);
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:contains, getFloat
            return mPrefLocal.getLong(key, defValue);
        } 
    } 
 
    public float getFloat(String key, float defValue) {
        if (isGlobal(key) || !mPrefLocal.contains(key)) {
            return mPrefGlobal.getFloat(key, defValue);
        } else { 
            return mPrefLocal.getFloat(key, defValue);
        } 
    } 
 
    public boolean getBoolean(String key, boolean defValue) {
        if (isGlobal(key) || !mPrefLocal.contains(key)) {
            return mPrefGlobal.getBoolean(key, defValue);
        } else { 
            return mPrefLocal.getBoolean(key, defValue);
        } 
    } 
 
6
CodeRank
This code example shows how to use the following methods:getFloat
	} 
 
	public float getFloat(String key, Float defaultValue)
	{ 
		// TODO Auto-generated method stub 
		return mSharedPreferences.getFloat(key, defaultValue);
	} 
 
	public double getDouble(String key, Double defaultValue)
	{ 
		// TODO Auto-generated method stub 
		try 
		{ 
			return Double.valueOf(getString(key, ""));
		} catch (Exception e)
		{ 
			// TODO: handle exception 
		} 
		return defaultValue;
	} 
5
CodeRank
This code example shows how to use the following methods:getFloat
 
	@Override 
	public float getFloat(String key, Float defaultValue)
	{ 
		// TODO Auto-generated method stub 
		return mSharedPreferences.getFloat(key, defaultValue);
	} 
 
	@Override 
	public double getDouble(String key, Double defaultValue)
	{ 
		// TODO Auto-generated method stub 
		try 
		{ 
			return Double.valueOf(getString(key, ""));
		} catch (Exception e)
		{ 
			// TODO: handle exception 
		} 
		return defaultValue;
5
CodeRank
This code example shows how to use the following methods:edit, getFloat
		       wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "tag");	        
		  } 
		   
		  // Get Calibration SD from Shared Preferences 
		  this.appSharedPrefs = context.getSharedPreferences("edu.ucsb.geog", Context.MODE_WORLD_READABLE);
	      this.prefsEditor = appSharedPrefs.edit();
	       
		  this.callibrationSD = appSharedPrefs.getFloat("callibrationSD", -99);
		  this.callibrationMean = appSharedPrefs.getFloat("callibrationMean", -99);
		  this.previousVector = new ArrayList<Double>(3);
		  this.vecLength = 0;
		   
		  // prevfix = null; 
		  this.fixcount = 0;
		  // Log.v("AcclThread", "Constructor END");  
		  simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
	  } 
	   
	    
	  @Override 
5
CodeRank
This code example shows how to use the following methods:getFloat
	 * @param defValue 
	 *            当不存在时返回的默认值。 
	 * @return 返回获取到的值,当不存在时返回默认值。 
	 */ 
	public float getFloat(String key, float defValue) {
		return mKV.getFloat(key, defValue);
	} 
 
	/** 
	 * 获取保存着的String对象。 
	 *  
	 * @param key 
	 *            键名 
	 * @param defValue 
	 *            当不存在时返回的默认值。 
	 * @return 返回获取到的值,当不存在时返回默认值。 
	 */ 
	public String getString(String key, String defValue) {
		return mKV.getString(key, defValue);
	} 
5
CodeRank
This code example shows how to use the following methods:getFloat
	} 
	public int getAge() { 
		return mPreferences.getInt(Keys.AGE, 0);
	} 
	public float getBankBalance() { 
		return mPreferences.getFloat(Keys.BANK_BALANCE, 100);
	} 
	public boolean getSubscribed() { 
		return mPreferences.getBoolean(Keys.SUBSCRIBED, true);
	} 
 
	public SharedPreferences getSharedPreferences() {
		return mPreferences;
	} 
 
	public void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) {
		mPreferences.registerOnSharedPreferenceChangeListener(listener);
	} 
 
	public void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) {
5
CodeRank

Related SharedPreferences getFloat Questions & Answers:

getFloat Method Overview
Retrieve a float value from the preferences.
See Code Examples for other Android SharedPreferences Methods: