Kotlins AndroidX ViewModelProviders错误

时间:2019-04-03 23:48:36

标签: android viewmodel androidx android-jetpack

androidx ViewModelProvider不允许“ this”作为有效参数,即使它是活动

private fun initializeUI(){
val factory = InjectorUtils.provideQuotesViewModelFactory()

    val viewModel = ViewModelProviders.of(this,factory).get(QuotesViewModel::class.java)

}

0 个答案:

没有答案