Back to project page jmjuanesFramework.
The source code is released under:
MIT License
If you think the Android project jmjuanesFramework 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 jmjuanes.core; //from ww w . j ava2s . c om import jmjuanes.Config; import android.content.Context; import android.content.SharedPreferences; //Subclase para manejar los records public class GameData { //Context private final Context context; //Nombre del contenedor de records public static final String PREFS_NAME = Config.ID; //Constructor public GameData(Context context) { this.context = context; } //Para obener el record public int Get(String name) { SharedPreferences sp = context.getSharedPreferences(PREFS_NAME, 0); return sp.getInt(name, 0); } //Para guardar el record public void Set(String name, int value) { SharedPreferences sp = context.getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = sp.edit(); editor.putInt(name, value); editor.commit(); } }