I’m building an Android app following the
MVVM architecture. Where do adapters (for
viewPager, etc) belong to?
adapters belong to
Adapter belongs to View, but data source of Adapter belongs to ViewModel.
If you’re following MVVM architecture than , adapters are belongs to
Viewmodel. All sub list item click events and other UI related things handled by adapter . So Adapter goes to View ..
if you want detail description , You can check this link to
Think on this direction..
Suppose you remove/replace your view from your code. View model should be able to reused again and can provide view data to new view. You can get answer yourself.
Then adapter should be part of view only.