Android Open Source - g3m_owm Prefs






From Project

Back to project page g3m_owm.

License

The source code is released under:

Copyright (c) 2013, Glob3 Mobile, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project g3m_owm listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.glob3.mobile.owm;
/*from   ww w.j  av a 2 s.c  o m*/
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;


public class Prefs {

   Context myContext;


   public Prefs(final Context ctx) {
      myContext = ctx;
   }


   /*
    * Store a preference via key -> value
    */
   public void setPreference(final String key,
                             final String value) {
      final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(myContext);
      final SharedPreferences.Editor editor = prefs.edit();
      editor.putString(key, value);
      editor.commit();
   }


   public void clearAllPreferences() {
      final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(myContext);

      final SharedPreferences.Editor editor = prefs.edit();
      editor.clear();
      editor.commit();
   }


   public String getPreference(final String key) {
      String val = "";
      final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(myContext);
      val = prefs.getString(key, "");
      return val;
   }


}




Java Source Code List

com.glob3.mobile.owm.DataSourceAdapter.java
com.glob3.mobile.owm.Dialogs.java
com.glob3.mobile.owm.G3MOWMMainActivity.java
com.glob3.mobile.owm.GPSTracker.java
com.glob3.mobile.owm.Prefs.java
com.glob3.mobile.owm.SettingsActivity.java
com.glob3.mobile.owm.shared.G3MOWMBuilder.java
com.glob3.mobile.owm.shared.G3MOWMListener.java
com.glob3.mobile.owm.shared.data.DataRetriever.java
com.glob3.mobile.owm.shared.data.DialogDataListener.java
com.glob3.mobile.owm.shared.data.Place.java
com.glob3.mobile.owm.shared.data.Places.java
com.glob3.mobile.owm.shared.data.SimpleRasterLayerBuilder.java
com.glob3.mobile.owm.shared.data.Utils.java
com.glob3.mobile.owm.shared.data.WeatherForecastParser.java
com.glob3.mobile.owm.shared.data.WeatherForecast.java
com.glob3.mobile.owm.shared.data.Weather.java