https://kotlinlang.org logo
Title
u

user

07/20/2022, 11:01 AM
Can't cast application to the ViewModel in Fragment So I'm trying to get along with the android codelabs about room, and I've faced some issue. I can't cast application in the ViewModel in fragment, but I can do it in Activity did I screw up something, or it's intended behaviour? Here's some code: Fragment private val wordViewModel: CurrencyDatabaseViewModel by viewModels { CurrencyDatabaseFactory((application as CurrencyApplication).repository) } the application is red. ViewModel class atabaseViewModel(private val DatabaseRepository:...