What can be a correct way to set an observer to change UI in case if data was changed?
As an example. In an Activity we have our TimerViewModel object (extended ViewModel), named mTimerViewModel. mTimerViewModel.timer method returns a LiveData<Long> value.
What can be a correct way to set an observer to change UI in case if data was changed?
A . mTimerViewModel!!.timer.value.toString().observe (Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) })
B . mTimerViewModel!!.timer.observe
(this, Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) })
C . mTimerViewModel.observe
(Observer { aLong -> callAnyChangeUIMethodHere(aLong!!) })
Answer: B
Latest Associate Android Developer Dumps Valid Version with 107 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments