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

  • Home
  • SEARCH
  • 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 6780237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:28:55+00:00 2026-05-26T16:28:55+00:00

I’ve got a class whose content is set to a layout which has a

  • 0

I’ve got a class whose content is set to a layout which has a few buttons and a TableLayout.

The real work that makes the TableLayout is in a separate static helper class, which has a method that returns the desired table.

However, the table is not displaying. What humiliatingly simple fact am I missing?

Here is the class whose content is set to the layout:

public class TesterActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TableLayout table = (TableLayout) findViewById(R.id.table);
        table = TableHelper.getTable_BINARY_NUMBERS(getApplicationContext(), 5, 25);
    }
}

And here is the helper class that creates the Table’s meat:

public class TableHelper {

    public static TableLayout getTable_BINARY_NUMBERS(Context context, int numRows, int numCols) {

        TableLayout table = new TableLayout(context);

        table.setStretchAllColumns(true);  
        table.setShrinkAllColumns(true);  

        TableRow[] rows = new TableRow[numRows];
        for (int row=0; row<numRows; row++) {
            rows[row] = new TableRow(context);

            for (int col=0; col<numCols-1; col++) {
                TextView num = new TextView(context);
                num.setText("0");
                rows[row].addView(num);
            }
            TextView rowText = new TextView(context);
            rowText.setText("Row " + (row + 1));
            rowText.setTextAppearance(context, android.R.style.TextAppearance_Small);
            rows[row].addView(rowText);
            rows[row].setPadding(0, 50, 0, 0);
            table.addView(rows[row]);
        }
        return table;
    }
}
  • 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-26T16:28:56+00:00Added an answer on May 26, 2026 at 4:28 pm

    Instead of returning a new table layout, pass the one you get right away to your getTable_BINARY_NUMBERS() and modify it in your method instead of returning a completely new one.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from

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.