code: public static double getDouble(SharedPreferences preferences, String key, double defaultValue) {
          String stored = preferences.getString(key, null);
          if (TextUtils.isEmpty(stored)) {
              return defaultValue;
          }
          return Double.parseDouble(stored);
      }
docs: Retrieve a double value from the preferences.
  @param preferences the preferences
  @param key the key
  @param defaultValue default value if the key is not present
  @return the double value.