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 8808487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:38:08+00:00 2026-06-14T02:38:08+00:00

I experiment with the table layout using one of the documented examples. With a

  • 0

I experiment with the table layout using one of the documented examples. With a barebone MainActivity that just has the following code up to setContentView(R.layout.activity_main), the emulator showed the table layout fine. I then added the lines after the setContentView line and that action caused :

  1. the layout not showing in the emulator (even after executing passed
    the setContentView line, when the code stopped at a breakpoint on
    the tableLayout declaration line)
  2. error at the line with the first getChildCount().

The code in the MainActivity is shown below:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    TableLayout tableLayout = null;
    int s = tableLayout.getChildCount(); 

    for(int n = 0; n < s; ++n) {
        TableRow row = (TableRow)tableLayout.getChildAt(n);
        int t = row.getChildCount();

}

What have I missed? Thanks for your help in advance.

  • 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-06-14T02:38:10+00:00Added an answer on June 14, 2026 at 2:38 am

    You have to initialise your TableLayout tableLayout like this:

    TableLayout tableLayout = findViewById(R.id.whatever_id_you_gave_to_the_tablelayout);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my actual table schema (I'm using Mysql) : Table experiment : code(int)
Just to experiment assembly in C++, I tried the following, which is causing the
I am using the following PNG fix for IE6: http://www.dillerdesign.com/experiment/DD_belatedPNG/ It is referenced thus
Heroku has just launched several new database plan, one of those plans is dev
I have the following database structure: Table 1 Table 2 Table 3 tid_1 ----(many-to-one)----
Using phpMyAdmin 5.1.44 to experiment with DML commands. I've been following tutorials on-line. SELECT
I have a huge data.table in R which contains the result of a experiment:
As an experiment we want to build our products using the Eclipse java compiler
Recently, I like using CSS-Table Layouts more and more. When I had another issue
In order to have a well scrambled table (for a psychological experiment), I'd like

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.