Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7643509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:28:04+00:00 2026-05-31T09:28:04+00:00

I’ve rearranged my code that dynamically creates widgets/views and, although the xml layout appears

  • 0

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.

IOW:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ondemandandautomatic_dynamicauthorize); <-- crashes when I F6 (Eclipse) on this line

…So then I noticed in my xml layout file a warning icon: “This TableLayout is useless (no children, no background, no id)”

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:

<TableLayout>
android:id="@id/tlDynamicRows" <-- IT'S RIGHT THERE!!!
android:layout_width="match_parent"
android:layout_height="match_parent" > 
</TableLayout>

There is another warning at the that says, “This TableRow or its TableRow parent is useless”

Here’s the entire xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:id="@+id/tlDynamic"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TableRow> <- This is where it says, "This TableRow or its TableRow parent is useless"

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/demand"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/time"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/space"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/contact"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </TableRow>
    </TableLayout>

    <ScrollView
        android:id="@+id/scrollViewHost"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true" >

        <TableLayout> <- 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" > 
        </TableLayout>
    </ScrollView>

</LinearLayout>

What could be causing this revolting development?

Updated:

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’).”

That part of the xml is now:

<TableLayout
    android:id="@id/tlDynamicRows"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</TableLayout>

What gives?

Update:

Here’s the xml that finally works:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:id="@+id/tlDynamic"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/demand"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/time"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/space"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="2dip"
                android:text="@string/contact"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </TableRow>
    </TableLayout>

    <ScrollView
        android:id="@+id/scrollViewHost"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true" >

        <TableLayout
            android:id="@+id/tlDynamicRows"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </TableLayout>
    </ScrollView>

</LinearLayout>

I still had a warning message to change this line in the TableLayout inside the ScrollView:

android:layout_height="wrap_content"

to:

android:layout_height="wrap_content"

I did, and it seemed to make no difference – but it got rid of the Warning, so I’ll leave it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:28:06+00:00Added an answer on May 31, 2026 at 9:28 am

    There are several points to be noted in the XML you posted above:

    1- When you are using the first Table Row

      <TableRow> <- This is where it says, "This TableRow or its TableRow parent is useless"
    

    In this line you are not specifying the layout_height and layout_width attributes of the row, that is why you are getting “useless” in warning.

    2- Another point is try giving id to Table Layout in Scroll view at the botton as:

     android:id="@+id/tlDynamicRows"
    

    instead of

     android:id="@id/tlDynamicRows"
    

    hope these work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.