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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:44:15+00:00 2026-05-25T19:44:15+00:00

I am new to this site..Please indicate me if there are any wrong I

  • 0

I am new to this site..Please indicate me if there are any wrong
I have xml.That contain TableLayout.Table row dynamically insert.

This is my xml :

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

<ScrollView android:layout_width="fill_parent"  
            android:layout_height="wrap_content" 
            android:id="@+id/sView1" 
            android:scrollbars="vertical">

    <LinearLayout android:id="@+id/lLayout2" 
                  android:layout_width="fill_parent" 
                  android:layout_height="396dp">

        <HorizontalScrollView android:id="@+id/hScrollView1" 
                              android:layout_width="fill_parent" 
                              android:layout_height="wrap_content" >

            <LinearLayout android:id="@+id/lLayout3" 
                          android:layout_width="fill_parent" 
                          android:layout_height="fill_parent" 
                          android:orientation="horizontal">

                <TableLayout  android:stretchColumns="*" 
                              android:layout_width="fill_parent" 
                              android:layout_margin="5pt" 
                              android:layout_marginTop="5dp"  
                              android:id="@+id/lineTable" 
                              android:layout_height="fill_parent">

                </TableLayout>
            </LinearLayout>
        </HorizontalScrollView>
    </LinearLayout>
</ScrollView>



 <!-- Footer -->
    <LinearLayout android:id="@+id/header"
        android:background="#000000"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent">

        <Button android:layout_width="wrap_content" 
                android:text="Cancel" 
                android:background="@drawable/btn_yellow"
                android:layout_height="wrap_content" 
                android:layout_marginLeft="5dp"
                android:layout_marginRight="190dp"
                android:id="@+id/button2" 
                android:textColor="#FFFFFF"
                android:onClick="onCancelAction">
       </Button>

        <Button android:layout_width="wrap_content" 
                android:text="Complete" 
                android:background="@drawable/btn_yellow"
                android:layout_height="wrap_content" 
                android:textColor="#FFFFFF"
                android:id="@+id/button2" 
                android:onClick="onCompleteAction">
       </Button>
    </LinearLayout>

This is dynamic table row creation :

    private  void loadTableLayout(){

    TableLayout.LayoutParams rowLp = new TableLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            1.0f);
    TableRow.LayoutParams cellLp = new TableRow.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
            1.0f);

    //Table Header
    TableRow th = new TableRow(this);

    TextView thCode = new TextView(this);
    thCode.setTextSize(1, 12);
    thCode.setTextColor(Color.BLACK);
    thCode.setText("Criteria");
    thCode.setPadding(10, 0, 12, 0);
    th.addView(thCode,cellLp); 

    TextView thDes = new TextView(this);
    thDes.setTextSize(1, 12);
    thDes.setTextColor(Color.BLACK);
    thDes.setText("Name");
    thDes.setPadding(10, 0, 16, 0);
    th.addView(thDes,cellLp); 

    TextView thQty = new TextView(this);
    thQty.setTextSize(1, 12);
    thQty.setText("DisQty");
    thQty.setTextColor(Color.BLACK);
    thQty.setPadding(10, 0, 10, 0);
    th.addView(thQty,cellLp); 

    TextView thValue = new TextView(this);
    thValue.setTextSize(12);
    thValue.setText("DisValue");
    thValue.setPadding(10, 0, 10, 0);
    thValue.setTextColor(Color.BLACK);
    th.addView(thValue,cellLp); 

    TextView thDisVal = new TextView(this);
    thDisVal.setTextSize(12);
    thDisVal.setText("DisProductCode");
    thDisVal.setPadding(10, 0, 8, 0);
    thDisVal.setTextColor(Color.BLACK);
    th.addView(thDisVal,cellLp); 
    th.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_shape));
    tl.addView(th,rowLp);

    if(lineDisList.size() > 0){
        //dynamic Table Contents
        for (int i = 0; i <lineDisList.size(); i++) {

            TableRow tr = new TableRow(this);   
            tr.setTag(i);

            //Set PDA Top panel data, when the list is load
            if(i == 0){

            }
            System.out.println(" --- " + lineDisList.get(i).getProductCode());
            System.out.println(" --- " + lineDisList.get(i).getCriteriaName());
            System.out.println(" --- " + lineDisList.get(i).getDiscountQty());
            System.out.println(" --- " + lineDisList.get(i).getDiscountValue());
            System.out.println(" --- " + lineDisList.get(i).getDiscountProductCode().length);


            TextView critiria = new TextView(this);
            critiria.setTextSize(12);
            critiria.setText(lineDisList.get(i).getProductCode());
            critiria.setPadding(10, 0, 10, 0);
            tr.addView(critiria,cellLp); 



            TextView description = new TextView(this);
            description.setTextSize(12);
            description.setText(lineDisList.get(i).getCriteriaName());
            description.setPadding(10, 0, 10, 0);
            description.setTextColor(Color.BLACK);
            tr.addView(description,cellLp);

            TextView disValue = new TextView(this);
            disValue.setTextSize(12);
            disValue.setPadding(10, 0, 10, 0);
            disValue.setTextColor(Color.BLACK);
            disValue.setText(Double.toString(lineDisList.get(i).getDiscountValue()));
            tr.addView(disValue,cellLp);


            TextView disQuantity = new TextView(this);
            disQuantity.setTextSize(12);
            disQuantity.setText("0.00");
            disQuantity.setPadding(10, 0, 10, 0);
            disQuantity.setTextColor(Color.BLACK);
            tr.addView(disQuantity,cellLp);

            tr.setBackgroundDrawable(getResources().getDrawable(R.drawable.table_shape));
            tl.addView(tr,rowLp);

        }
    }

}

I got this kind of error:

    09-21 17:18:01.959: ERROR/AndroidRuntime(389): FATAL EXCEPTION: main
09-21 17:18:01.959: ERROR/AndroidRuntime(389): java.lang.StackOverflowError
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6880)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6986)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1409)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6986)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.ScrollView.draw(ScrollView.java:1409)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.View.draw(View.java:6883)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewRoot.draw(ViewRoot.java:1522)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 17:18:01.959: ERROR/AndroidRuntime(389):     at android.os.L

Please kindly request everybody, if you know any suggestion or idea please advice me what is wrong in my code?

Thanks

  • 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-25T19:44:15+00:00Added an answer on May 25, 2026 at 7:44 pm

    following links may help you.

    http://www.stealthcopter.com/blog/2010/01/android-eclipse-and-problems-with-dynamic-tables-adding-rows/

    how to add child to tablerow dynamically in android?

    http://en.androidwiki.com/wiki/Dynamically_adding_rows_to_TableLayout

    Thank you.

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

Sidebar

Related Questions

I am new to this site & Android, If there are any wrong please
First I would like to say that I am new to this site, never
I'm new on both this site and ruby on rails! I have a common
I am planning a new website with codeigniter using wordpress. this site will contain
Hi I am new on this site so please forgive me if i am
I'm kind of new to this site and programming in general, so please excuse
I'm relatively new to programming and am new to this site, please bear with
I'm new to this site, I have been coding a script to block certain
I have check this site for solutions but i didn't find something that can
new to this site so sorry if this question is inappropriate, or in the

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.