title: Databinding and BaseObserver - Android MVVM
body: <p>I have a textfield which is databound to a view model like the xml here and I want the UI to update the txtProvider field on click of the cardView.
  How should I notify the change to the view from my viewmodel? </p>
  
  <pre><code>&lt;layout xmlns:bind="http://schemas.android.com/tools"&gt;
  &lt;data&gt;
      &lt;variable name="viewmodel"        
                type="io.leapingwolf.myapp.viewmodel.MyViewModel"/&gt;
     &lt;variable
      name="myModel"
      type="io.leapingwolf.myapp.models.MyModel"/&gt;
  &lt;/data&gt;
      &lt;android.support.v7.widget.CardView 
          xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"   
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:id="@+id/cardView"
          app:cardCornerRadius="5dp"
          app:cardUseCompatPadding="true"
          android:onClick="@{viewmodel.onClickModel}"&gt;
          &lt;TextView
              android:id="@+id/txtProvider"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_alignParentStart="true"
              android:text="@{myModel.provider}"
              android:textColor="@android:color/black"
              android:textSize="15sp" /&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>In MyViewModel(which extends BaseObserver class), I have</p>
  
  <pre><code>fun onClickModel() : View.OnClickListener {
          val viewOnClick = View.OnClickListener { v -&gt;
                                  myModel!!.provider = "name changed"
                                  notifyPropertyChanged(BR.myModel)
                                  Toast.makeText(context,"clicked:" + myModel!!.provider , Toast.LENGTH_SHORT).show()}
                                  return viewOnClick
          }
  </code></pre>
  
  <p>My data class :</p>
  
  <pre><code>data class MyModel(
          val type: String?,
          var  provider: String? 
  ) : AutoParcelable
  </code></pre>