Back to project page ABTester.
The source code is released under:
MIT License
If you think the Android project ABTester 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 ab.tester.prefs; /*w w w. java 2s .c o m*/ import android.annotation.SuppressLint; import android.content.Context; import android.content.SharedPreferences; public abstract class ABSharedPrefs { public static final String SEPARATOR = "___"; protected SharedPreferences prefs; protected abstract String getPrefsName(); public ABSharedPrefs(Context context) { this.prefs = context.getSharedPreferences(getPrefsName(), Context.MODE_PRIVATE); } @SuppressLint("NewApi") public void apply(SharedPreferences.Editor editor){ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) editor.apply(); else editor.commit(); } }