title: Android data Binding - ObservableArrayMap how to implement in a POJO
body: <p>From the observable objects section of the android blog on <a href="http://developer.android.com/tools/data-binding/guide.html#data_binding_layout_files" rel="nofollow">data binding</a></p>
  
  <p>The POJO class should extend BaseObservable unless your using ObservableFields.  Let's look at my current POJO which is very simple and just stores an observableInt:</p>
  
  <pre><code>public class User {
  public ObservableInt visible;
  
  public User(int visible) {
      this.visible=new ObservableInt(visible);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I want to add an Observable Collection to this pojo but im not clear how to layout the xml if i do that.  How would i call it.  Lets say i want to add the current arraymap to my POJO:</p>
  
  <pre><code>ObservableArrayMap&lt;String, Object&gt; myCollection = new ObservableArrayMap&lt;&gt;();
  myCollection.put("firstName", "Google");
  myCollection.put("lastName", "Inc.");
  myCollection.put("age", 17);
  </code></pre>
  
  <p>How do i incorporate this into my xml for data binding. My xml file is simple and looks like this:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;data&gt;
          &lt;variable name="user" type="com.example.android.floatingactionbuttonbasic.User"/&gt;
      &lt;/data&gt;
      &lt;LinearLayout
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;TextView android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="my first textview"/&gt;
  
          &lt;TextView android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="my second textview"
              android:visibility="@{user.visible}"/&gt;
  
      &lt;/LinearLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>I am confused how i would add variables for ObservableArrayMap into this xml file and be able to use it.  Can someone help ?I feel i can pass it into the User POJO fine, its just from xml i dont know how i'd reference it? The reason im confused is because the ObservableArrayMap is going to be a attribute of the User class, how do i access it since its going to be a member of the User class ?</p>