<?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">

<FrameLayout
  android:id="@+id/fl"
       android:orientation="vertical"
 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
   
       >
</FrameLayout>
 <Button
     android:id="@+id/FButton1"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:onClick="mClick"
     android:text="돌아가기"
     android:visibility="visible" />
</LinearLayout>

 

그리고 oncreate함수에

 super.onCreate(savedInstanceState);

  setContentView(R.layout.frontall);

fL = (FrameLayout)findViewById(R.id.fl);

   MyView vm=new MyView(this);

btn = (Button)findViewById(R.id.FButton1);
   fL.addView(btn);
   fL.addView(vm);

 

이렇게 했더니

   fL.addView(btn);  여기 부분에서

 

11-25 05:54:32.058: E/AndroidRuntime(3140): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.hiju/test.hiju.FrontAll}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

다음같은 에러가 나는데요

 

버튼 말고 새로운 FrameLayout을 만들어서 해도 같은에러인것같은데요;; 해결책좀 알려주세요 (__)