Android Room persistence library @Update not working

前端 未结 3 1618
南旧
南旧 2021-02-05 09:42

I am trying to update my database via new android room library, but it is not working. Here it is my approach

@IgnoreExtraProperties
@Entity(tableName = CarModel         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 10:22

    I am sorry for posting this as an answer but I am not allowed to add a simple comment yet so here is my idea:

    Have you tried using only insertCars() instead of updateCars()? Anyway it looks like your isCarsEmpty() LiveData callback gets triggered the whole time because when the observer is called the Database is altered again.. I am not quite sure what you want to accomplish tho.

提交回复
热议问题