Description
SharePreferences is very popular with any project and all most all project has SharePreferences for saving data. This library will help you faster in configuration and use SharePreferences in your project. Let's setup and enjoy!
preferences-helper alternatives and similar packages
Based on the "Utility" category.
Alternatively, view preferences-helper alternatives based on common mentions on social networks and blogs.
-
timber
A logger with a small, extensible API which provides utility on top of Android's normal Log class. -
ExpirableDiskLruCache
DISCONTINUED. Java implementation of a Disk-based LRU cache which specifically targets Android compatibility. -
Android-Templates-And-Utilities
Collection of source codes, utilities, templates and snippets for Android development. -
secure-preferences
DISCONTINUED. Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure. -
greenrobot-common
General purpose utilities and hash functions for Android and Java (aka java-common) -
Androl4b
A Virtual Machine For Assessing Android applications, Reverse Engineering and Malware Analysis -
vector-compat
A support library for VectorDrawable and AnimatedVectorDrawable classes introduced in Lollipop -
CastCompanionLibrary-android
DISCONTINUED. CastCompanionLibrary-android is a library project to enable developers integrate Cast capabilities into their applications faster and easier. -
motion
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt -
Colours
A beautiful set of predefined colors and a set of color methods to make your Android development life easier. -
Reservoir
DISCONTINUED. Android library to easily serialize and cache your objects to disk using key/value pairs.
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of preferences-helper or a related project?
README
preferences-helper
SharePreferences is very popular with any project and all most all project has SharePreferences for saving data. This library will help you faster in configuration and use SharePreferences in your project. Let's setup and enjoy!
Setup
Add to build.gradle in app level
implementation 'com.github.tntkhang:preferences-helper:1.3.2'
Init the PreferencesHelper in your CustomApplication.java extend from Application with 2 ways:
Will use app name as of Preferences file name
PrefHelper.initHelper(this);
Will use
CustomName
as the name of SharePreferences filePrefHelper.initHelper(this, "CustomName");
- How to use
### SET VALUE:
PrefHelper.setVal(KEY_BOOLEAN, true);
PrefHelper.setVal(KEY_DOUBLE, 123.123);
PrefHelper.setVal(KEY_FLOAT, 234.234f);
PrefHelper.setVal(KEY_INT, 345);
PrefHelper.setVal(KEY_LONG, Long.MAX_VALUE);
PrefHelper.setVal(KEY_STRING, "Khang");
UserModel userModel = new UserModel("KhangTran", 27);
PrefHelper.setVal(KEY_OBJECT, userModel);
List<String> stringList = Arrays.asList("Tran", "Nguyen", "Thai", "Khang");
PrefHelper.setVal(KEY_ARRAY_LIST, stringList);
String[] arr = new String[4];
arr[0] = "Tran 2";
arr[1] = "Nguyen 2";
arr[2] = "Thai 2";
arr[3] = "Khang 2";
PrefHelper.setVal(KEY_ARRAY, arr);
Map<String, String> stringMap = new HashMap<>();
stringMap.put("Tr", "Tran");
stringMap.put("N", "Nguyen");
stringMap.put("Th", "Thai");
stringMap.put("K", "Khang");
PrefHelper.setVal(KEY_MAP, stringMap);
### GET VALUE:
boolean booleanValue = PrefHelper.getBooleanVal(KEY_BOOLEAN, false);
double doubleValue = PrefHelper.getDoubleVal(KEY_DOUBLE, Double.MIN_VALUE);
float floatValue = PrefHelper.getFloatVal(KEY_FLOAT, Float.MIN_VALUE);
int intValue = PrefHelper.getIntVal(KEY_INT, Integer.MIN_VALUE);
long longValue = PrefHelper.getLongVal(KEY_LONG, Long.MIN_VALUE);
String stringValue = PrefHelper.getStringVal(KEY_STRING, "Empty");
UserModel userModel = PrefHelper.getObjectVal(KEY_OBJECT, UserModel.class);
List<String> stringList = PrefHelper.getListVal(KEY_ARRAY_LIST);
String[] strings = PrefHelper.getArrayVal(KEY_ARRAY);
Map<String, String> stringMap = PrefHelper.getMapVal(KEY_MAP);
Map<String, ?> stringMap = PrefHelper.getAll();
# DEMO
Download and run project for simple demo
That is, let's enjoy!