Skip to content
This repository was archived by the owner on Jun 8, 2025. It is now read-only.

Preferences Storage

Steven Lewi edited this page Jul 14, 2015 · 2 revisions

Preferences Storage uses SharedPreferences to store the data into xml file. So, This feature is only a wrapper class make SharedPreferences easier to use. If you want to store any kind of Object, not just simple object (String, int, long, float, double), you can use Session Storage.

Get Preferences Storage

Access this method from your activity / fragment

PreferencesStorage pref = getDefaultPreferencesStorage();
Set Value
pref.put("key_name", "any string value...");
pref.put("key_name", 1);
Get Value
String stringValue = pref.get("key_name", String.class);
int integerValue = pref.get("key_name", Integer.class);
Remove Value
pref.remove("key_name");

Clone this wiki locally