Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Persist the db key to storage
* Save the storable instance to preferences.
* @param storable a storable instance
fun saveToPrefs(context: Context, storable: Storable) {
val serialized = Gson().toJson(storable)
val prefs = context.getSharedPreferences("database",
prefs.edit().putString("key", serialized).apply()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.