问题
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