当前位置:网站首页>ViewModelProvider. Of obsolete solution

ViewModelProvider. Of obsolete solution

2022-07-07 07:07:00 Dream of changing life

Outdated methods

 open fun <T : ViewModel?> createViewModel(activity: FragmentActivity?, cls: Class<T>?): T {
        return ViewModelProviders.of(activity!!).get(cls)
    }

Replace with

   open fun <T : ViewModel?> createViewModel(activity: FragmentActivity?, cls: Class<T>?): T {
        return ViewModelProvider(activity!!).get(cls!!)
    }
原网站

版权声明
本文为[Dream of changing life]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070214222191.html