Back to project page g3m_owm.
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.
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; } }