-
Notifications
You must be signed in to change notification settings - Fork 496
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
Navigation in mvvm #21
Comments
itemView.getContext() then do the same as case 1. |
I think View Model shouldn't know anything about View, right ? |
@steven274 i share your opinion about view model not knowing anything about view, even about platform specific stuff. What i tend to do when dealing with use cases you described (startactivityforresult) is to create interface: <view_model>Delegate with implementation from activity. Then you can invoke: delegate.doSomethingWhatRequiresStartActivityForResult() and from onActivityResult (in host activity) invoke viewModel.success(response). With this approach you can mock <view_model>Delegate implementation and test viewModel with local tests, its just plan old platform independent java code. |
The text was updated successfully, but these errors were encountered: