public class DaoPreferences
extends java.lang.Object
| Constructor and Description |
|---|
DaoPreferences(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
apply(T object,
java.lang.String key)
Save a object using that key as filename.
|
void |
clear(java.lang.String key)
Clear a key
|
<T> T |
commit(T object,
java.lang.String key)
Save a object using that key as filename.
|
<T> T |
load(T object,
java.lang.String key)
Fill a empty object with loaded data.
|
public DaoPreferences(android.content.Context context)
context - we need the context to be able to save/load the preferences.public <T> T load(T object,
java.lang.String key)
T - The object type will be detectedobject - A empty objectkey - The key was used to save the objectpublic <T> T apply(T object,
java.lang.String key)
SharedPreferences.Editor#apply().T - The object type will be detectedobject - The object you want to savekey - The key used to retrieve the object later.public <T> T commit(T object,
java.lang.String key)
SharedPreferences.Editor#commit().T - The object type will be detectedobject - The object you want to savekey - The key used to retrieve the object later.public void clear(java.lang.String key)
key - The key to be cleared