67.12 Adding LiveData Observers
The user interface now needs to add observers to remain synchronized with the searchResults and allProducts live data objects within the ViewModel. Remaining in the Mainfragment.java file, implement the observer setup method as follows:
.
.
import androidx.lifecycle.Observer;
.
.
import java.util.List;
import java.util.Locale;
.
.
private void observerSetup() {
mViewModel.getAllProducts().observe(getViewLifecycleOwner(),
new Observer<List<Product>>() {
@Override
public void onChanged(@Nullable final List...