I am working on a custom keyboard app that uses Inputmethod service class and has the keyboard UI. As I have read on a comment in Github " ViewModel should be used closely with an Activity or a Fragment". https://github.com/android/architecture-components-samples/issues/137#issuecomment-327854042 Does that mean we cannot use viewmodel in service class with UI like InputmethodService class and Why?
Asked
Active
Viewed 119 times
1
-
why would you want to use a viewmodel ? – a_local_nobody Jan 18 '22 at 13:49
-
@a_local_nobody to pass data between activity and service – Raju Pathak Jan 18 '22 at 14:03
-
services existed before view models, so is there no other way of doing it ? – a_local_nobody Jan 18 '22 at 14:06
-
of course, there are other ways, but services are easier no? – Raju Pathak Jan 18 '22 at 14:08