Android Room : LiveData callback of update insert?

Can i use LiveData to wrap Delete, Insert, Update calls? No, you can’t. I wrote an answer to the issue. The reason is, that LiveData is used to notify for changes. Insert, Update, Delete won’t trigger a change. It will return the deleted rows, the inserted ID or the affected rows. Even if it looks … Read more

Android: How to make type converters (for Room) generic for all List of objects in Kotlin

Will something like this won’t work for templating? abstract class Converters<T> { @TypeConverter fun mapListToString(value: List<T>): String { val gson = Gson() val type = object : TypeToken<List<T>>() {}.type return gson.toJson(value, type) } @TypeConverter fun mapStringToList(value: String): List<T> { val gson = Gson() val type = object : TypeToken<List<T>>() {}.type return gson.fromJson(value, type) } } … Read more

Android Architecture Components: Using Enums

I can use enum values at Room with TypeConverters. There are some parts to change at your code: 1) You must declare your Entity’s fields public or they must have public getters/setters. Or you’ll get below error: yourField is not public in YourEntity; cannot be accessed from outside package 2) You don’t need the @Embedded … Read more

Backup Room database

This doesn’t answer the original question How can I properly re-open room db after I close it? However, if moving everything to the original database file is what you want to do, then you don’t have to close the database in the first place. You can instead force a checkpoint using the wal_checkpoint pragma. Query … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)