Search code examples
androiddata-bindingbidirectional

Android - How to do a bi directional binding with com.android.databinding:dataBinder?


How to do a bi directional binding (from UI to data and from data to UI) using the new dataBinder plugin ?

Thanks a lot!


Solution

  • We don't have this yet, maybe after v1. Not sure what your use case is but we already create fields for each View with an id so when you need the data, you can get it using that view.

    e.g. if you have <EditText android:id="@+id/mytext"/>

    Generated binding class will have public final EditText mytext;.