title: Why does the compiler say I'm not giving my TableLayout an id when I am?
body: <p>I've rearranged my code that dynamically creates widgets/views and, although the xml layout appears to be "well-formed" (it compiles), when I get to the corresponding "setContentView()" it crashes.</p>
  
  <p>IOW:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.ondemandandautomatic_dynamicauthorize); &lt;-- crashes when I F6 (Eclipse) on this line
  </code></pre>
  
  <p>...So then I noticed in my xml layout file a warning icon: "This TableLayout is useless (no children, no background, no id)"</p>
  
  <p>Well, I'm going to add the children at runtime; why does it need a background? And the big question: why does it say it has no id, when I've added one:</p>
  
  <pre><code>&lt;TableLayout&gt;
  android:id="@id/tlDynamicRows" &lt;-- IT'S RIGHT THERE!!!
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt; 
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>There is another warning at the  that says, "This TableRow or its TableRow parent is useless"</p>
  
  <p>Here's the entire xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TableLayout
          android:id="@+id/tlDynamic"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;TableRow&gt; &lt;- This is where it says, "This TableRow or its TableRow parent is useless"
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/demand"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/time"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/space"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/contact"
                  android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
          &lt;/TableRow&gt;
      &lt;/TableLayout&gt;
  
      &lt;ScrollView
          android:id="@+id/scrollViewHost"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:fillViewport="true" &gt;
  
          &lt;TableLayout&gt; &lt;- This is where it says, "says, "This TableRow or its TableRow parent is useless"
          android:id="@id/tlDynamicRows"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt; 
          &lt;/TableLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What could be causing this revolting development?</p>
  
  <p>Updated:</p>
  
  <p>When looking over my post, I saw that the final "TableLayout" in the xml had a superfluous right angle bracket. So, I took the first one out, and now I get an err msg, namely, "No resource found that matches the given name (at 'id' with value '@id/tlDynamicRows')."</p>
  
  <p>That part of the xml is now:</p>
  
  <pre><code>&lt;TableLayout
      android:id="@id/tlDynamicRows"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  &lt;/TableLayout&gt;
  </code></pre>
  
  <p>What gives?</p>
  
  <p>Update:</p>
  
  <p>Here's the xml that finally works:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TableLayout
          android:id="@+id/tlDynamic"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;TableRow
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/demand"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/time"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/space"
                  android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_margin="2dip"
                  android:text="@string/contact"
                  android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
          &lt;/TableRow&gt;
      &lt;/TableLayout&gt;
  
      &lt;ScrollView
          android:id="@+id/scrollViewHost"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:fillViewport="true" &gt;
  
          &lt;TableLayout
              android:id="@+id/tlDynamicRows"
              android:layout_width="match_parent"
              android:layout_height="match_parent" &gt;
          &lt;/TableLayout&gt;
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I still had a warning message to change this line in the TableLayout inside the ScrollView:</p>
  
  <pre><code>android:layout_height="wrap_content"
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>android:layout_height="wrap_content"
  </code></pre>
  
  <p>I did, and it seemed to make no difference - but it got rid of the Warning, so I'll leave it.</p>