O
O
Oleg Gamega2015-10-04 11:58:27
Android
Oleg Gamega, 2015-10-04 11:58:27

What is Activity in MVVM and where to implement business logic?

Hello.
In my free time, I continue to look for a silver bullet for android applications)))
I thought about what Activity is from the point of view of mvvm?
Before the advent of data-binding, everything is just Activity is ViewModel, layout files are View, I saw the mvvm implementation where Activity is view, viewmodel is a class inherited by BaseObservable (optional) and implements business logic.
What raises doubts:
Activity as a View ─ on the one hand, it is logical to leave only animations and embellishments in it and take work with data and interface separately, on the other hand, the Android architecture itself makes it a ViewModel
How kosher is the business logic in the ViewModel?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Varakosov, 2015-10-04
@thelongrunsmoke

From my point of view, it makes sense to put the business logic in a service, thereby decoupling it from the life cycle of the activity. In the case of MVVM, this is more of a ViewModel than a Model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question