hey guys, have anybody tried <https://developer.an...
# android
d
hey guys, have anybody tried https://developer.android.com/topic/libraries/architecture/index.html ? i'm not sure how to fetch resources (strings, colors etc) inside of
ViewModel
. Of course we can use
AndroidViewModel
which receives
Application
as a constructor param. But in this case we expose android implementation and can't easily test our
ViewModel
with unit tests (without mocking the app)
a
deviant: with
ViewModel
, I would create an wrapper of
Resources
and inject it via the constructor, perhaps provide an android implementation as a default constructor parameter, then you could mock it in tests easily.
👍 1
it doesn’t use ObservableFields though