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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:42:17+00:00 2026-06-09T05:42:17+00:00

I am having an error that I don’t understand what does it mean. I

  • 0

I am having an error that I don’t understand what does it mean. I am kindly new to Android

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

I am trying to add a radio group to a table layout programmatically

first I add the radio group to the table layout and i add the radio button to the radio group

RadioGroup mRadioGroup;
mRadioGroup = new RadioGroup(this);
TableLayout mainTable = (TableLayout) findViewById(R.id.myTable);
mainTable.addView(mRadioGroup);

Then I create a row and add the radio group to this row and finally ad the row to the table layout

TableRow row;
RadioButton radioButton = new RadioButton(this);
radioButton.setId(1);
radioButton.setText("SomeText");
row.addView(mRadioGroup);

mainTable.addView(row);

Can any one help ?

EDIT : It worked when i added the radio group directly on the table layout not on a table row

  • 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-09T05:42:19+00:00Added an answer on June 9, 2026 at 5:42 am

    Your problem was that you were adding mRadioGroup to both mainTable and row:

    mainTable.addView(mRadioGroup);
    ...
    row.addView(mRadioGroup);
    

    As you partly discovered, remove either one of these lines and it will work.

    You don’t have to add a View to a TableRow in order to add it to a TableLayout, but it behaves differently depending on whether or not you do.

    Also, you never actually initialized row – make sure to do

    TableRow row = new TableRow(this);
    

    before you use it!

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

Sidebar

Related Questions

I am having an error that I don't understand in my Dijkstra Algorithm code
Well, i am having some issues with an error that i don't understand. These
I'm having a link error under cmake that I don't have when compiling on
I'm having an sql error that i can't work out. I have to update
I keep getting a Run Time error that says I am having an Exception
I am having an error: Error 2 'int[]' does not contain a definition for
I am having this error in my j2ee web application. java.sql.SQLException: ORA-00604: error occurred
Having a weird issue. I'm new to Macs and have a windows VM that
I'm having a weird error that happens under weird circumstances. The list of skill
I am having trouble using rsh in the PHP exec() command. The error that

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.