title: Access PCL ViewModel from MainActivity in Xamarin.Droid
body: <p>I am using a Xamarin.Forms Portable solution in VS2015. I bound my contentpage in the PCL to a ViewModel using MVVM Light. If i now change one of my properties in the ViewModel it would update the UI on Android, IOS and UWP. However, i am stuck at a point where i am not sure how to realize updating the ViewModel property.</p>
  
  <p>In my droid project MainActivity i am registering a new intent, using the inherited <code>OnNewIntent</code> from Activity. As soon as this <code>OnNewIntent</code> is called i want to change properties in the ViewModel, for example a <code>public string example</code>. I cannot simply do it using </p>
  
  <pre><code>ViewModel vm = new ViewModel();
  vm.example = "Hi from Android";
  </code></pre>
  
  <p>as i then create a new instance of the ViewModel and my DataBinding is referencing another instance. So what is a proper way of doing this? I thought about using DependencyInjection in the getter of my ViewModel properties, like</p>
  
  <pre><code>public string example 
  {get {%using dependency injection here to get the string from Android }}
  </code></pre>
  
  <p>but then i also have to notify the ViewModel that the binding has to be updated when <code>OnNewIntent</code> is called in the MainActivity. </p>
  
  <p>So i would be very thankful for any suggestions how to organize this in a good way.</p>