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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:00:50+00:00 2026-05-25T10:00:50+00:00

my code is here if(c!=null) { c.moveToFirst(); String col = c.getString(2); // check.setText(col); check.setVisibility(0);

  • 0

my code is here

if(c!=null) 
{           
    c.moveToFirst();
    String col = c.getString(2); //  
    check.setText(col);
    check.setVisibility(0);

    while(!c.isAfterLast()) 
    {
        String col1 = c.getString(1); 
        String col2 = c.getString(2);    
        String col3 = c.getString(3);

            while(!c.isAfterLast())
        {
            TextView que1 = new TextView(this);
            que1.setText(col1);
            lymn.addView(que1);

            if(col3.equals("Date"))
            {
                DatePicker dp = new DatePicker(this);
                lymn.addView(dp);
                break;
            }

            if(col3.equals("User Input"))
                    {
                EditText ed = new EditText(this);
                ed.setWidth(250);

                lymn.addView(ed);
                break;
            }

            if(col3.equals("YES/NO"))
            {
                yes1.setText("Yes");
                no1.setText("NO");

                rg1.addView(yes1);
                rg1.addView(no1); 
                lymn.addView(rg1);

                break;
            }

            if(col3.equals("High Average Low"))
            {
                High1.setText("High");
                Avg1.setText("Average");
                Low1.setText("Low"); 

                rg2.addView(High1);
                rg2.addView(Avg1);
                rg2.addView(Low1);

                lymn.addView(rg2);

                break;
            }

            if(col3.equals("Excellent Good Average Poor"))
            {
                exce1.setText("Excellent");
                good1.setText("Good");
                avg11.setText("Average"); 
                poor1.setText("Poor");

                rg3.addView(exce1);
                rg3.addView(good1);
                rg3.addView(avg11);
                rg3.addView(poor1);

                lymn.addView(rg3);

                break;
            }
            break;     
        }

        c.moveToNext(); 
    }
}

when i run this code igot error like this

09-06 11:34:37.777: WARN/Exception(27814): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 
09-06 11:34:37.777: WARN/Exception(27814):     at android.view.ViewGroup.addViewInner(ViewGroup.java:1970) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.view.ViewGroup.addView(ViewGroup.java:1865) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.view.ViewGroup.addView(ViewGroup.java:1822) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.view.ViewGroup.addView(ViewGroup.java:1802) 
09-06 11:34:37.777: WARN/Exception(27814):     at com.ezee.app.user1.LoadCheckIn(user1.java:256) 
09-06 11:34:37.777: WARN/Exception(27814):     at com.ezee.app.user1.onCreate(user1.java:61) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.os.Handler.dispatchMessage(Handler.java:99) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.os.Looper.loop(Looper.java:123) 
09-06 11:34:37.777: WARN/Exception(27814):     at android.app.ActivityThread.main(ActivityThread.java:4627) 
09-06 11:34:37.777: WARN/Exception(27814):     at java.lang.reflect.Method.invokeNative(Native Method) 
09-06 11:34:37.777: WARN/Exception(27814):     at java.lang.reflect.Method.invoke(Method.java:521) 
09-06 11:34:37.777: WARN/Exception(27814):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
09-06 11:34:37.777: WARN/Exception(27814):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
09-06 11:34:37.777: WARN/Exception(27814):     at dalvik.system.NativeStart.main(Native Method)

plz help me on this

  • 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-25T10:00:50+00:00Added an answer on May 25, 2026 at 10:00 am

    The error you are getting is hard to find because your code is all over the place, but the error means you are adding a View (child) that is allready on the screen (has a parent).

    This could be anywhere, hard to say with this post, but for example:

    This one probably works:

      EditText ed = new EditText(this);
      ed.setWidth(250);
      lymn.addView(ed);
    

    ed is new, so doesn’t have a parent.

    But I can’t find the declaration of yes1, so this one MIGHT be the culprint. Or maybe no1.

      yes1.setText("Yes");
      no1.setText("NO");
      rg1.addView(yes1);
      rg1.addView(no1); 
      lymn.addView(rg1);
    

    Check all your addView calls. (hint: there is a line-number in that error somewhere. use it)

    To try to answer your question in the comment, you must follow these rules;

    • Never add any view more then once.
    • When a View is allready used (e.g., you got it with findViewById, don’t use addView on it.
    • When you want to add a view, use addView with a NEW view.
    • You can add several of these new views to one view, but you cannot add that one view multiple times.
    • You can’t re-use a view simply by changing some stuff. You CAN re-use a variable, but you need to make a new view if you want to re-add it using addView.

    And, I can’t stress this more: find out, using the line-number in the error, which line produces the error. Look at what you are adding there, and try to figure out with above help why that doesn’t work.

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

Sidebar

Related Questions

I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I am using pseudo-code here, but this is in JavaScript. With the most efficient
Edit: The code here still has some bugs in it, and it could do
I've got this code here: SqlCommand CodeStatus = new SqlCommand(SQL, DB); DB.Open(); Reader =
We have some old C code here that's built with nmake. Is there an
I am compiling a legacy C code here and there is a lot of
I have a piece of code here that i really could use some help
I am a total Groovy newbie. I saw the following code here . def
const static int foo = 42; I saw this in some code here on
I found a code samples here: http://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx But it's very complex and involves manipulating

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.