title: Create two-way binding with Android Data Binding
body: <p>I have implemented the new Android data-binding, and after implementing realised that it does not support two-way binding. I have tried to solve this manually but I am struggling to find a good solution to use when binding to an EditText. 
  In my layout I have this view:</p>
  
  <pre><code>&lt;EditText
  android:id="@+id/firstname"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:inputType="textCapWords|textNoSuggestions"
  android:text="@{statement.firstName}"/&gt;
  </code></pre>
  
  <p>Another view is also showing the results:</p>
  
  <pre><code>&lt;TextView
  style="@style/Text.Large"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@{statement.firstName}"/&gt;
  </code></pre>
  
  <p>In my fragment I create the binding like this: </p>
  
  <pre><code>FragmentStatementPersonaliaBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_statement_personalia, container, false);
  binding.setStatement(mCurrentStatement);
  </code></pre>
  
  <p>This works and puts the current value of firstName in the EditText. The problem is how to update the model when the text changes. I tried putting an OnTextChanged-listener on the editText and updating the model. This created a loop killing my app (model-update updates the GUI, which calls textChanged times infinity). Next I tried to only notify when real changes occured like this: </p>
  
  <pre><code>@Bindable
  public String getFirstName() {
      return firstName;
  }
  
  public void setFirstName(String firstName) {
          boolean changed = !TextUtils.equals(this.firstName, firstName);
          this.firstName = firstName;
          if(changed) {
              notifyPropertyChanged(BR.firstName);
          }
      }
  </code></pre>
  
  <p>This worked better, but everytime I write a letter, the GUI is updated and for som reason the edit-cursor is moved to the front. </p>
  
  <p>Any suggestions would be welcome</p>