Is it possible use @NotifyChange instead of BindUtils.postNotifyChange?

放肆的年华 提交于 2019-12-05 19:29:13
Nabil A.

1) If the variable associated with "isDisabled" is not changed in any case by this call, you don't need to.
But maybe it is changed inside loadFolderInfoList()
2) You can imagine that a @NotifyChange({"arg1","arg2",...,"argN"}) is the same as

for(String arg : args){ 
  BindUtils.postNotifyChange(null, null, refToClassCalledFrom, arg); 
}

3) But you can call BindUtils.postNotifyChange(...) from everywhere as long as you got a reference to the VM.
4) To me it looks like this code is from a nested class of FolderInfoEditViewModel, that it self is is VM as well as FolderInfoEditViewModel.
In this case the @NotifyChage(...) is invoked for the nested class but

BindUtils.postNotifyChange(null, null, FolderInfoEditViewModel.this, "folderInfoList");

refers to it's outer class FolderInfoEditViewModel and that can only be archived this way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!