Skip to content
New issue

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

BaseViewModel 为什么要实现LifecycleObserver接口,具体干什么用的 #14

Closed
sweet2o09 opened this issue Jul 28, 2020 · 2 comments

Comments

@sweet2o09
Copy link

/**
 *   @auther : Aleyn
 *   time   : 2019/11/01
 */
open class BaseViewModel : AndroidViewModel(Utils.getApp()), LifecycleObserver
@aleyn97
Copy link
Owner

aleyn97 commented Jul 29, 2020

为了能知道Activity生命周期,比如有一些依赖Activity生命周期的操作,就可以用@OnLifecycleEvent(Lifecycle.Event.ON_RESUME) 等这些注解 直接 写在 ViewModel中

@sweet2o09
Copy link
Author

原来如此,我是看你的这个框架里面没有相关的注解所以有点困惑 @AleynP

@aleyn97 aleyn97 closed this as completed Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants