add radio button Dynamically : android
<p>i need to add radio button Dynamically , means radio button may be 3 , 4, 5 or 6 and it would be Added Horizontally and one row contains maximum 3 radio button , if there are more then 3 then it would come below of above row of radio button as in grid view , i am stukking here from 2 days but not get yet any solution ..please help , any help would be highly appreciated..
my code for radio button are below but it display all radio button in a single row,..means its hiding the radiobutton..</p>

<p>main.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
 android:orientation="vertical" &gt;

   &lt;TextView
 android:id="@+id/TextView01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="Choose Your Favorite Actress" &gt;
  &lt;/TextView&gt;

 &lt;RadioGroup
android:id="@+id/RadioGroup01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" &gt;
 &lt;/RadioGroup&gt;
 &lt;Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" &gt;
 &lt;/Button&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>ANd java class is:</p>

<pre><code>  @Override
  public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       DisplayRadioButton();
  }


  public void DisplayRadioButton() {
       for(int i=0;i&lt;10;i++) {
           RadioGroup radiogroup = (RadioGroup)findViewById(R.id.RadioGroup01);
           RadioButton rdbtn = new RadioButton(this);
           rdbtn.setId(i);
           rdbtn.setText(text[i]);
           radiogroup.addView(rdbtn);
  }

}
</code></pre>
