我可以在背景线程上调用setValue,并保持观察功能
java.lang.IlgalStateException:无法在背景线程上调用setValue
尝试使用setValue时会出现上述错误:
data.setValue(arrayListListLogrEterturn)
我 可以将其更改为后值,但后来我失去了观察到Livedata上的功能。
data.postvalue(ArrayListLogreTurn);
我的问题是如何保持观察功能并更新值?任何帮助将不胜感激。
java.lang.IllegalStateException: Cannot invoke setValue on a background thread
I get the above error when I try to use setvalue:
data.setValue(arrayListLogReturn);
I understand that I can change this to postvalue, but then I lose observe functionality on the livedata.
data.postValue(arrayListLogReturn);
My question is how do I keep observe functionality and update the value ? Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论