title: How do I represent an Object Array in XML with data binding?
body: <p>With data binding, I am trying to connect my member variable <code>Tile[] tiles</code> which resides in <code>Model model</code> to the <code>TextView</code>s in my XML file. However, I am getting the following gradle error:</p>
  
  <pre><code>Error:(106, 33) Identifiers must have user defined types from the XML file. tiles is missing it
  </code></pre>
  
  <p>This is (part of) my XML:</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="(Tile[]) tiles"
              type="com.myapp.Model" /&gt;
      &lt;/data&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
              &lt;TextView
                  android:id="@+id/tv0"
                  android:layout_width="100dp"
                  android:layout_height="100dp"
                  android:text='@{tiles[0].getValue == 0 ? "" : tiles[0].getValue}'
                  android:textSize='@{tiles[0].getValue &amp;lt; 100 ? "48sp" : tiles[0].getValue &amp;lt; 1000 ? "36sp" : "24sp"}'/&gt;
  
              &lt;TextView
                  android:id="@+id/tv1"
                  android:layout_width="100dp"
                  android:layout_height="100dp"
                  android:text='@{tiles[1].getValue == 0 ? "" : tiles[1].getValue}'
                  android:textSize='@{tiles[1].getValue &amp;lt; 100 ? "48sp" : tiles[1].getValue &amp;lt; 1000 ? "36sp" : "24sp"}'/&gt;
  
          ...
  
      &lt;/RelativeLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>This is (part of) my <code>Model</code> class:</p>
  
  <pre><code>class Model {
      private Tile[] tiles = new Tile[16];
  
      Model(Tile[] tiles) {
          setTiles(tiles);
      }
  
      Tile[] getTiles(){ return tiles;}
  
      void setTiles(Tile[] tiles) { System.arraycopy(tiles, 0, this.tiles, 0, tiles.length); }
  
      int getValue(int index) { return tiles[index].getValue(); }
  
      void setValue(int index, int value) { tiles[index].setValue(value); }
  
      int getId(int index) { return tiles[index].getId(); }
  
      void setId(int index, int id) { tiles[index].setId(id);}
  }
  </code></pre>
  
  <p>And this is (part of) my <code>Tile</code> class:</p>
  
  <pre><code>class Tile {
      private int value;
      private int id;
  
      Tile(int id, int value) {
          this.id = id;
          this.value = value;
      }
  
      int getValue() {
          return value;
      }
  
      void setValue(int value) {
          this.value = value;
      }
  
      int getId() {
          return id;
      }
  
      void setId(int id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>Most likely, this line is wrong: <code>type="com.myapp.Model"</code>, since the type of my tiles variable is not <code>Model</code>, but the compiler/gradle does not let me put <code>com.myapp.Tile</code> nor <code>com.myapp.Tile[]</code> nor <code>com.myapp.Model.Tile[]</code>. How do I correctly declare my <code>Tile[]</code> variable?</p>