Back to project page ponyville-live-android.
The source code is released under:
Apache License
If you think the Android project ponyville-live-android 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.ponyvillelive.app.prefs; // w w w . j a va 2 s. c om import android.content.SharedPreferences; public class IntPreference { private final SharedPreferences preferences; private final String key; private final int defaultValue; public IntPreference(SharedPreferences preferences, String key) { this(preferences, key, 0); } public IntPreference(SharedPreferences preferences, String key, int defaultValue) { this.preferences = preferences; this.key = key; this.defaultValue = defaultValue; } public int get() { return preferences.getInt(key, defaultValue); } public boolean isSet() { return preferences.contains(key); } public void set(int value) { preferences.edit().putInt(key, value).apply(); } public void delete() { preferences.edit().remove(key).apply(); } }