title: LiveData is not updating its value after first call
body: <p>I have been beating my head against the wall and I cannot understand why this is happening. I am working with the new Architectural Components for Android and I am having problems updating a LiveData with a List of Objects.
  I have two spinners. When i change the option in the first one, The second one must have its content changed. But this last part is not happening. 
  Can anyone help me?</p>
  
  <p><strong>State.java</strong></p>
  
  <pre><code>@Entity(tableName = "states")
  public class State{
  
  @PrimaryKey(autoGenerate = false)
  private int id;
  
  private String name;
  
  @ColumnInfo(name = "countryId")
  private String CountryId;
  
  @Ignore
  private Object geoCenter, geoLimit;
  
  public State(){
  
  }
  
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getCountryId() {
      return CountryId;
  }
  
  public void setCountryId(String countryId) {
      CountryId = countryId;
  }
  }
  </code></pre>
  
  <p><strong>StateDAO</strong></p>
  
  <pre><code>@Dao
  public interface StateDao {
  
  @Query("SELECT * FROM states")
  LiveData&lt;List&lt;State&gt;&gt; getAllStates();
  
  @Query("SELECT * FROM states WHERE countryId = :countryID")
  LiveData&lt;List&lt;State&gt;&gt; getStatesFromCountry(String countryID);
  
  @Query("SELECT COUNT(*) FROM states")
  int getNrStates();
  
  @Query("SELECT COUNT(*) FROM states WHERE countryId = :countryID")
  int getNrStatesByCountry(String countryID);
  
  @Insert(onConflict = IGNORE)
  void insertAll(List&lt;State&gt; states);
  
  @Delete
  void delete(State state);
  }
  </code></pre>
  
  <p><strong>StateRepository</strong></p>
  
  <pre><code>@Singleton
  public class StatesRepository {
  
  private final WebServices services;
  private final StateDao stateDao;
  private final Executor executor;
  
  @Inject
  public StatesRepository(Executor executor, StateDao stateDao, WebServices services) {
      this.services = services;
      this.stateDao = stateDao;
      this.executor = executor;
  }
  
  
  public LiveData&lt;List&lt;State&gt;&gt; getStates(String token){
      refreshStates(token);
  
      return stateDao.getAllStates();
  }
  
  public LiveData&lt;List&lt;State&gt;&gt; getStatesFromCountry(String countryID){
  
      return stateDao.getStatesFromCountry(countryID);
  }
  
  private void refreshStates(final String token){
  
      executor.execute(() -&gt; {
  
          Log.d("oooooo", stateDao.getNrStates() + "");
          if(stateDao.getNrStates() == 0){
  
              try {
                  Response&lt;List&lt;State&gt;&gt; response = services.getStates("Bearer "+token).execute();
  
                  stateDao.insertAll(response.body());
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      });
  }
  }
  </code></pre>
  
  <p><strong>StateViewModel</strong></p>
  
  <pre><code>public class StatesViewModel extends ViewModel {
  
  private LiveData&lt;List&lt;State&gt;&gt; states;
  private StatesRepository repo;
  
  @Inject
  public StatesViewModel(StatesRepository repository){
  
      this.repo = repository;
  }
  
  public void init(String token){
  
      states = repo.getStates(token);
  }
  
  public void getStatesFromCountry(String countryID){
  
      states = repo.getStatesFromCountry(countryID);
  
  }
  
  public LiveData&lt;List&lt;State&gt;&gt; getStates(){
  
      return this.states;
  }
  
  }
  </code></pre>
  
  <p><strong>Fragment</strong></p>
  
  <pre><code>public class EditAddressFragment extends LifecycleFragment implements View.OnClickListener, Injectable{
  
  
  private Spinner country, city, state, zip_code;
  private String token;
  private List&lt;Country&gt; countries;
  private List&lt;City&gt; cities;
  private List&lt;State&gt; states;
  @Inject ViewModelFactory viewModelFactory;
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.addresses_edit_layout, container, false);
  
      city = view.findViewById(R.id.city);
      state = view.findViewById(R.id.state);
      country = view.findViewById(R.id.country);
      ...
  
      countries = new ArrayList&lt;&gt;();
      cities = new ArrayList&lt;&gt;();
      states = new ArrayList&lt;&gt;();
  
      return view;
  }
  
  
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
  
      CountrySpinnerAdapter adapter = new CountrySpinnerAdapter(getActivity(), android.R.layout.simple_spinner_item, countries);
      country.setAdapter(adapter);
  
      CitySpinnerAdapter cityAdapter = new CitySpinnerAdapter(getActivity(), android.R.layout.simple_spinner_item, cities);
      city.setAdapter(cityAdapter);
      StateSpinnerAdapter stateAdapter = new StateSpinnerAdapter(getActivity(), android.R.layout.simple_spinner_item, states);
      state.setAdapter(stateAdapter);
  
  
      CountriesViewModel countriesViewModel = ViewModelProviders.of(this, viewModelFactory).get(CountriesViewModel.class);
      countriesViewModel.init(token);
      countriesViewModel.getCountries().observe(this, adapter::setValues);
  
      CityViewModel cityViewModel = ViewModelProviders.of(this, viewModelFactory).get(CityViewModel.class);
      cityViewModel.init(token);
      cityViewModel.getCities().observe(this, cityAdapter::setValues);
  
      StatesViewModel statesViewModel = ViewModelProviders.of(this, viewModelFactory).get(StatesViewModel.class);
      statesViewModel.init(token);
      statesViewModel.getStates().observe(this, states -&gt; { 
        Log.d("called", states.toString()); 
        stateAdapter.setValues(states); } );
  
  
      country.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
  
              Country c = (Country) adapterView.getItemAtPosition(i);
  
              Log.d("cd", c.getId());
  
              //states = new ArrayList&lt;State&gt;();
  
              statesViewModel.getStatesFromCountry(c.getId());
  
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {
  
          }
      });
  </code></pre>
  
  <p>....</p>
  
  <p><strong>Adapter</strong></p>
  
  <pre><code>public void setValues(List&lt;State&gt; states)
  { 
  this.states = states; 
  Log.d("s", states.isEmpty()+" "+states.toString()); 
  notifyDataSetChanged(); 
  }
  </code></pre>