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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:11:17+00:00 2026-05-26T19:11:17+00:00

I am mking an android app in which i am making dynamically table rows

  • 0

I am mking an android app in which i am making dynamically table rows and then adding imageviews and textviews to it dynamically.
It adds the first row and then give the following exception

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

I am using the following code for it:

          ar1= new JSONArray(children.toString());
                                for(int mn=0;mn<ar1.length();mn++){
                                    value=ar1.getString(mn);
    TableRow tr = new TableRow(HomePageWithPhoneIsOfflineDialog.this);
                                    tr.setBackgroundColor(Color.WHITE);
                                    tr.setId(100+mn);
                                    tr.setMinimumHeight(60);
                                    tr.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
                                    TextView child= new TextView(HomePageWithPhoneIsOfflineDialog.this);
                                    child.setId(200+mn);
                                    child.setHeight(50);
                                    child.setGravity(Gravity.CENTER);
                                    child.setTextColor(Color.BLACK);
                                    System.out.println(value);
                                    child.setText(value);
                                    System.out.println("adding iv");
                                    tr.addView(iv,0);
                                    System.out.println("adding child");
                                    tr.addView(child);
                                    System.out.println("adding table row");
                                     table.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

}

Can anyone tell me how to solve this problem.

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-26T19:11:18+00:00Added an answer on May 26, 2026 at 7:11 pm

    The iv variable that you are adding, is not been created inside the loop so I imagine is created before… but in the second loop it’s added to two different Table Rows.

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

Sidebar

Related Questions

I am making an android app in which I need to make different tables
I am making an android app in which i want to make a dynamic
I am making an android database app in which when i fetch values from
We are in the making of an Android app, a quiz game, which we
I am making android app in which I am facing problem . The overview
I am making an android app which will have two services that will keep
hey every body, i am making an android app which interacts with camera. i
I’m making an android app, which uses Google maps. One functionality is that the
I am making an android app in which i have to use progress dialog
I am making an android app in which the user needs to add information.

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.