title: Android LiveData - how to reuse the same ViewModel on different activities?
body: <p>Example ViewModel:</p>
  
  <pre><code>public class NameViewModel extends ViewModel {
      // Create a LiveData with a String
      private MutableLiveData&lt;String&gt; mCurrentName;
  
      public MutableLiveData&lt;String&gt; getCurrentName() {
          if (mCurrentName == null) {
              mCurrentName = new MutableLiveData&lt;&gt;();
          }
          return mCurrentName;
      }
  
  }
  </code></pre>
  
  <p>Main activity:</p>
  
  <pre><code>mModel = ViewModelProviders.of(this).get(NameViewModel.class);
  
  // Create the observer which updates the UI.
  final Observer&lt;String&gt; nameObserver = textView::setText;
  
  // Observe the LiveData, passing in this activity as the LifecycleOwner and the observer.
  mModel.getCurrentName().observe(this, nameObserver);
  </code></pre>
  
  <p>I want to call <code>mModel.getCurrentName().setValue(anotherName);</code> in second activity and make MainActivity receive changes. Is that possible?</p>