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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:57:35+00:00 2026-05-23T02:57:35+00:00

I am creating a TableRow at runtime. The trouble I have is that I

  • 0

I am creating a TableRow at runtime. The trouble I have is that I have 6 TextViews created and added to the TableRow but for some reason only 3 of the TextViews appear, the 1st 2 and the last one. I know that there is no problem adding the TextView to the TableRow because if I comment out the last 2 TextViews the fourth one still overwrites the third. Because of this it seems to be that there is a limit somewhere on the number of columns I can add to this TableRow.

Any ideas where I am going wrong?

Here is my java

public class locationlist extends Activity {
    /** Called when the activity is first created. */
    private locationListDbAdapter mDbHelper;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       setContentView(R.layout.locationlist);
        mDbHelper = new locationListDbAdapter(this);
        mDbHelper.open();

        String id = mDbHelper.fetchRow(1).getString(0);
        String locationText  = mDbHelper.fetchRow(1).getString(1);
        String localCode = mDbHelper.fetchRow(1).getString(2);
        String localService = mDbHelper.fetchRow(1).getString(3);
        String localComments = mDbHelper.fetchRow(1).getString(4);
        String localNextes = mDbHelper.fetchRow(1).getString(5);



        TextView idView = new TextView(this);
        idView.setText(id);
        TextView locationView = new TextView(this);
        locationView.setText(locationText);
        TextView codeView = new TextView(this);
        codeView.setText(localCode);
        TextView serviceView = new TextView(this);
        codeView.setText(localService);
        TextView commentsView = new TextView(this);
        codeView.setText(localComments);
        TextView nextesView = new TextView(this);
        codeView.setText(localNextes);

        TableLayout tl = (TableLayout)findViewById(R.id.tableLayout1);
        TableRow r2 = new TableRow(this);


        r2.addView(idView);
        r2.addView(locationView);
        r2.addView(codeView);
        r2.addView(serviceView);
        r2.addView(commentsView);
        r2.addView(nextesView);
        tl.addView(r2);

        this.setContentView(tl);

This is the xml file I am pointing it at

<?xml version="1.0" encoding="utf-8"?>

    <TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content">
        <TableRow android:layout_height="wrap_content" android:id="@+id/tableRow1" android:layout_width="fill_parent">
            <TextView android:id="@+id/textView11" android:layout_height="wrap_content" android:text="ID" android:layout_width="0dip" android:layout_weight="0.1"></TextView>
            <TextView android:id="@+id/textView1" android:layout_height="wrap_content" android:text="Location" android:layout_width="0dip" android:layout_weight="0.4"></TextView>
            <TextView android:id="@+id/textView2" android:layout_height="wrap_content" android:text="Type" android:layout_width="0dip" android:layout_weight="0.15"></TextView>
            <TextView android:id="@+id/textView3" android:layout_height="wrap_content" android:text="Service" android:layout_width="0dip" android:layout_weight="0.2"></TextView>
            <TextView android:id="@+id/textView4" android:layout_height="wrap_content" android:text="Comments" android:layout_weight="0.3" android:layout_width="0dip"></TextView>
            <TextView android:id="@+id/textView5" android:layout_height="wrap_content" android:text="ES" android:layout_width="0dip" android:layout_weight="0.15"></TextView>
        </TableRow>
            <View
        android:layout_height="2dip"
        android:background="#FF909090" />
    </TableLayout>
  • 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-23T02:57:36+00:00Added an answer on May 23, 2026 at 2:57 am

    Why do you have the following lines? You set your codeView TextView to localCode’s text, then you overwrite that three times for no discernible reason:

    codeView.setText(localCode);
    codeView.setText(localService);
    codeView.setText(localComments);
    codeView.setText(localNextes);
    

    Your serviceView, commentsView and nextesView TextView’s all appear to be blank, you never do anything like this:

    serviceView.setText(localService);
    commentsView.setText(localComments);
    nextesView.setText(localNextes);
    

    I would temporarily replace your database stuff with test strings so as to narrow down the error, see if it is still failing, if not, work on the things mentioned above, test again, if it is working now, replace the temporary text strings with the database stuff.

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

Sidebar

Related Questions

I have a page where I am dynamically creating an asp.net table. At some
i just creating an android ap. so in that i created a connection with
I have created a login page for an App I am creating. I am
I have a problem that sounds like this: I am creating a set of
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
So if I'm dynamically creating textviews in a foreach loop and want to assign
I'm doing some ASP.NET development in VS and have just found an interesting little
I have a few ideas for dealing with this, but I expect the guRus
Creating the closure is easy but using it is confusing for me. Here is

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.