java.lang.IllegalStateException: Cannot invoke observeForever on a background thread

前端 未结 3 642
梦谈多话
梦谈多话 2021-01-17 10:43

Can someone help me find where I am going wrong here. I need to continously observer network data and update the UI whenever there is a data change from the Worker. Please n

3条回答
  •  春和景丽
    2021-01-17 10:53

    In another solution, you can call it from main dispatcher as

    GlobalScope.launch(Dispatchers.Main) {
      // your code here...
    }
    

提交回复
热议问题