android/codelab-android-lifecycles

Codelab step 3 and webpage seem out of step

sum1nil opened this issue · 1 comments

In LiveDataTimeViewModel.java step 3, the CodeLab at https://codelabs.developers.google.com/codelabs/android-lifecycles/#3 states:
2. Next, set the new elapsed time value in the LiveDataTimerViewModel class. Find the following comment:
//TODO set the new value
Replace the comment with the following statement:
mElapsedTime.setValue(newValue);

Which does result in the error stated in the CodeLab code starting at line 48:
// setValue() cannot be called from a background thread so post to main thread.
// TODO post the new value with LiveData.postValue()
// mElapsedTime.setValue(newValue); // as instructed by webpage results in the error
mElapsedTime.postValue(newValue); // no error but not explicitly stated in the webpage itself.

Seems to not reflect each other unless that is the point.
By the way, these components are much needed I think and I wished I had discovered them sooner :)

Thanks for reporting this and the feedback! Completely correct - code comment was updated and now updating the text.