Указанный ребенок уже имеет родитель

Мой код здесь

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(); 
    }
}

Когда я запустил этот код igot ошибка вроде этого

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 поможет мне на это

14
задан Piyush 10 June 2013 в 07:42
поделиться