Android -room persistent library - DAO calls are async, therefore how to get callback?

后端 未结 3 1948
一向
一向 2021-02-05 05:29

From what i have read Room doesn’t allow you to issue database queries on the main thread (as can cause delays on the main thread)). so imagine i am trying to

3条回答
  •  隐瞒了意图╮
    2021-02-05 06:13

    If you want to do your query synchronously and not receive notifications of updates on the dataset, just don't wrap you return value in a LiveData object. Check out the sample code from Google.

    Take a look at loadProductSync() here

提交回复
热议问题