BaseViewModel 为什么要实现LifecycleObserver接口,具体干什么用的
sweet2o09 opened this issue · comments
wo叫天然呆 commented
/**
* @auther : Aleyn
* time : 2019/11/01
*/
open class BaseViewModel : AndroidViewModel(Utils.getApp()), LifecycleObserver
Aleyn commented
为了能知道Activity生命周期,比如有一些依赖Activity生命周期的操作,就可以用@OnLifecycleEvent(Lifecycle.Event.ON_RESUME) 等这些注解 直接 写在 ViewModel中
wo叫天然呆 commented
原来如此,我是看你的这个框架里面没有相关的注解所以有点困惑 @AleynP