Back to project page AGOGCyberStat.
The source code is released under:
MIT License
If you think the Android project AGOGCyberStat 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.agog.cyberstat; /*from w w w. j a v a 2 s. c o m*/ import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class MyPrefs { private static SharedPreferences sSettings; private static SharedPreferences.Editor sEditor; public static void init(Context context) { sSettings = PreferenceManager.getDefaultSharedPreferences(context); } @SuppressLint("CommitPrefEdits") public static void putString(String key,String value) { if(sEditor == null) { sEditor = sSettings.edit(); } sEditor.putString(key,value); } @SuppressLint("CommitPrefEdits") public static void putBoolean(String key,Boolean value) { if(sEditor == null) { sEditor = sSettings.edit(); } sEditor.putBoolean(key,value); } public static void commit() { if(sEditor == null) { sEditor = sSettings.edit(); } sEditor.commit(); } public static String getString(String key,String d) { return(sSettings.getString(key,d)); } public static Boolean getBoolean(String key,Boolean d) { return(sSettings.getBoolean(key,d)); } }