title: How can ViewModel react to its own livedata field changes?
body: <pre><code>public class WeatherDataViewModel extends ViewModel {
      private MutableLiveData&lt;String&gt; cityName = new MutableLiveData&lt;&gt;();
      private MutableLiveData&lt;WeatherData&gt; weatherData = new MutableLiveData&lt;&gt;();
  
      private final WeatherDataService service = new retrofit2.Retrofit.Builder()
              .baseUrl(&quot;https://api.openweathermap.org&quot;)
              .addConverterFactory(GsonConverterFactory.create())
              .build()
              .create(WeatherDataService.class);
  
  
      public LiveData&lt;String&gt; getCityName() {
          return cityName;
      }
      public void setCityName(String cityName) {
          this.cityName.setValue(cityName);
      }
      
      // i want to send request everytime cityName ( live data field ) is being changed and inside this function 
      // i want to update weatherData ( another live data field)
      public void updateWeatherData(String cityName, MutableLiveData&lt;WeatherData&gt; weatherData) {
  
          service.getWeatherData(cityName).enqueue(new Callback&lt;WeatherData&gt;() {
              @Override
              public void onResponse(Call&lt;WeatherData&gt; call, Response&lt;WeatherData&gt; response) {
                  Log.i(&quot;RETROFIT&quot;, response.toString());
                  weatherData.setValue(response.body());
              }
  
              @Override
              public void onFailure(Call&lt;WeatherData&gt; call, Throwable t) {
                  Log.e(&quot;RETROFIT&quot;, t.getMessage());
                  Log.e(&quot;RETROFIT&quot;, &quot;Nie udało się pobrać poprawnie danych z API&quot;);
              }
          });
      }
  
  }
  </code></pre>
  <p>I want to send request everytime cityName ( live data field ) is being changed and inside this function updateWeatherData method I  want to update weatherData ( another live data field)</p>
  <p>Can someone help?</p>