I find a lot of arguments have the error
Type mismatch
required: FragmentActivity
found: FragmentActivity?
I'm not sure of what's the best way to address this problem. Currently, I wrap the line in a variable?.let{ statement }
meViewModel = ViewModelProviders.of((iMainActivity as Fragment).activity, vmf).get(MeViewModel::class.java) }
into
val fragmentActivity = (iMainActivity as Fragment).activity
fragmentActivity?.let
{
meViewModel = ViewModelProviders.of(fragmentActivity, vmf).get(MeViewModel::class.java)
}
is it the right way to approach this