The Y's
Saving persistent data in android can sometime be a lot of trouble, in case it's a data that we can save in RDBMS we're good.
However if we are talking about a single row (e.g. saving a token session) we gonna have to use that SharedPreferences which can sometime take a bit more work than we actually first intend to (committing, use the default file or save it to private file? should I make the file public?)
The WAT
Introducing SharedSqlite! a simple and intuitive way to save your persistent data that do not fit in the table
without the hassle of committing, reading etc.
The Use
To create a new instance simply call
SharedSqlite.initialize(context);
Then you are free to call
SharedSqlite.addValue(key, value);
Wherever you want when key and value can be any primitive data type (or enum), to use call -
getStringValue(key, defaultValue)
getIntValue(key, defaultValue)
getLongValue(key, defaultValue)
getDoubleValue(key, defaultValue)
getFloatValue(key, defaultValue)
getBooleanValue(key, defaultValue)
To get the String/int/long/double/float or boolean saved value respectively, in case the key has no mapping your default value will be returned.
The Jar
Jar file can be downloaded straight from here just add it to your project 'libs' folder and your'e good to go.