我当时使用的是Realm,但现在想移至Room数据库。
由于Room Database
查询在后台线程上运行,因此我对此有疑问。在领域上,我已将user number
,user name
,user password
保存在领域上,并按顺序进行一些操作。
正如文档所述:
Disables the main thread query check for Room.
Room ensures that Database is never accessed on the main thread because it may lock the main thread and trigger an ANR. If you need to access the database from the main thread, you should always use async alternatives or manually move the call to a background thread.
You may want to turn this check off for testing.
但是在房间里,由于背景原因,我必须等待用户密码才能进行操作。有什么事可以不用等待吗?
I am not sharing my code here because I am thinking how to do it before starting it.