Kotlin does not understand ViewModelProviders.of(activity ?: fragment)
Inside my Fragment I initialize a ViewModel using ViewModelProviders.
I want it to take its Activity if not null, otherwise itself (Fragment).
private val viewModel: MainViewModel by lazy {
ViewModelProviders.of(activity ?: this).get(MainViewModel::class.java)
}
None of the following functions can be called with the arguments supplied.
of(Fragment) defined in androidx.lifecycle.ViewModelProviders
of(FragmentActivity) defined in androidx.lifecycle.ViewModelPro
It seems...