Database Dependent (Room) Conditional startDestination Android Navigation

我的未来我决定 提交于 2021-01-29 11:23:18

问题


I'm setting a conditional startDestination, as e.g. seen here:

https://stackoverflow.com/a/51961843/393607

The problem: The condition should depend on a room query. This query can't be run on the main thread of course, the onCreate of the MainActivity would have to wait for the query to be finished before constructing the navigation graph.

Any recommendations on how to go about this?


回答1:


Ok that was fast. Kotlin's really great: wrapping everything in runBlocking {} did the trick. I'll leave this here, in case somebody needs it.



来源:https://stackoverflow.com/questions/56706751/database-dependent-room-conditional-startdestination-android-navigation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!