Shan
07/01/2019, 2:45 AMgildor
07/01/2019, 3:11 AMShan
07/01/2019, 3:12 AMgildor
07/01/2019, 3:15 AMShan
07/01/2019, 3:21 AMjava.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
😞viewModelScope.coroutineContext
which is bound to Dispatchers.Main
gildor
07/01/2019, 3:41 AMShan
07/01/2019, 3:43 AMviewModel.launch {
val destination = destinationsDao.getLastActive(true)
}
from my fragment. the query is:
@Query("SELECT * FROM destinations WHERE last_active = :lastActive")
fun getLastActive(lastActive: Boolean) : Destination?
gildor
07/01/2019, 3:46 AM