We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我看项目中的ViewModel都是通过by lazy 对象的构造方法实例化的,这样实例化的ViewModel 是不是不能保证ViewModel与Fragment、activity的生命周期关联?例如: private val mViewModel: WanViewModel by lazy { WanViewModel() } 是不是应该用ViewModelProvider或者ViewModelProvider.Factory去实例化比较好?
The text was updated successfully, but these errors were encountered:
@Kotlin2022 如果你要多页面共用数据,就使用ViewModelProvider共享数据
Sorry, something went wrong.
我当时转kotlin的时候使用没那么熟练,也是小白,别人这样我就这样了
No branches or pull requests
我看项目中的ViewModel都是通过by lazy 对象的构造方法实例化的,这样实例化的ViewModel 是不是不能保证ViewModel与Fragment、activity的生命周期关联?例如:
private val mViewModel: WanViewModel by lazy { WanViewModel() }
是不是应该用ViewModelProvider或者ViewModelProvider.Factory去实例化比较好?
The text was updated successfully, but these errors were encountered: