How to pass dymanic tablelayout into xml form in linearlayout?
<p>I created a dynamic TableLayout using source in java class(DynamicTableLayout.java) . Using this code</p>

<pre><code>public class DynamicTableLayout extends Activity {


@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    TableLayout layout = new TableLayout (this);
    layout.setLayoutParams( new TableLayout.LayoutParams(4,3) );

    TableLayout.LayoutParams rowLp = new TableLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT,
            1.0f);

    rowLp.setMargins(6, 0, 0,0);

    TableRow.LayoutParams cellLp = new TableRow.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.FILL_PARENT,
            1.0f);

    cellLp.setMargins(6,0, 0, 0);

    layout.setPadding(3,1,1,1);

    for (int f=0; f&lt;=6; f++) {

        TableRow tr = new TableRow(this);

       tr.setBackgroundColor(Color.BLACK);
       tr.setPadding(1,1,1,1 );

       TableRow.LayoutParams llp = new TableRow.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
       llp.setMargins(2, 0, 0, 0);




       for (int c=0; c&lt;=3; c++) {

           LinearLayout cell = new LinearLayout(this);
           cell.setBackgroundColor(Color.WHITE);
           cell.setLayoutParams(llp);//2px border on the right for the cell

            TextView b = new TextView (this);
            b.setText("Sample");
            b.setTextSize(10.0f);

            b.setPadding(0, 0, 0, 0);

            cell.addView(b);
            tr.addView(cell,cellLp);

       } 
        layout.addView(tr,rowLp);

    } 

    super.setContentView(layout);
} }
</code></pre>

<p>main.xml code is</p>

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

  &lt;LinearLayout 
  android:id="@+id/linear1"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/bottom_black_pane"
  android:orientation="horizontal"&gt;

    &lt;TextView 
    android:id="@+id/textview1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Color range"
    android:gravity="center"
    android:textSize="20dp"
    android:textColor="#ffffff"  
    android:paddingTop="10dp"/&gt;
      &lt;/LinearLayout&gt;

  &lt;LinearLayout 
android:id="@+id/linear2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"&gt;

    &lt;ImageView android:id="@+id/imageView1"
    android:src="@drawable/palette"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"&gt;

    &lt;/ImageView&gt;
&lt;/LinearLayout&gt;

&lt;LinearLayout 
android:id="@+id/linear2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"&gt;
&lt;/LinearLayout&gt;

&lt;LinearLayout 
android:id="@+id/linear3"
android:layout_height="wrap_content"
android:background="@drawable/bottom_black_pane" 
android:layout_width="wrap_content"&gt;

&lt;LinearLayout 
android:layout_height="wrap_content"
android:orientation="horizontal"
 android:weightSum="1" android:layout_width="355dp"&gt;

&lt;Button 
android:id="@+id/Btn1"
android:layout_width="30dp"
android:text="All" 
android:paddingTop="10dp"
android:layout_height="wrap_content" 
android:textColor="#ffffff"
android:background="#000000"
android:layout_weight="0.18"/&gt;

&lt;Button android:layout_width="30dp"
    android:layout_weight="0.18"
    android:textColor="#ffffff"
    android:background="#000000"
    android:paddingTop="10dp"
    android:id="@+id/Btn2" 
    android:layout_height="wrap_content" 
    android:text="Virbate"&gt;&lt;/Button&gt;

&lt;Button 
android:id="@+id/Btn2"
android:layout_width="30dp"
android:text="Warm" 
android:textColor="#ffffff"
android:paddingTop="10dp"
android:background="#000000"
android:layout_height="wrap_content" 
android:layout_weight="0.18"/&gt;

&lt;Button 
android:id="@+id/Btn2"
android:layout_width="40dp"
android:text="Fresh" 
android:textColor="#ffffff"
android:paddingTop="10dp"
android:background="#000000"
android:layout_height="wrap_content" 
android:layout_weight="0.18"/&gt;

&lt;Button 
android:id="@+id/Btn2"
android:layout_width="40dp"
android:text="Calm" 
android:textColor="#ffffff"
android:paddingTop="10dp"
android:background="#000000"
android:layout_height="wrap_content" 
android:layout_weight="0.09"/&gt;

&lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;

&lt;ScrollView 
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:scrollbars="vertical"
android:layout_height="fill_parent"&gt;

    &lt;HorizontalScrollView android:id="@+id/horizon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"&gt;

&lt;LinearLayout android:id="@+id/list_parent"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="horizontal" 
  android:weightSum="1"&gt;


&lt;/LinearLayout&gt;
&lt;/HorizontalScrollView&gt;
&lt;/ScrollView&gt;

 &lt;/LinearLayout&gt;
</code></pre>

<p>main class code id</p>

<pre><code>public class DuluxColorGridActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);




}
</code></pre>

<p>}</p>

<p>what will i do to integrate the both layouts together,i want to integrate dynamic layout into main.xml layout in the field linearLayout id=list_parent below i declare. help me to solve this problem.</p>

<pre><code>&lt;LinearLayout android:id="@+id/list_parent"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="horizontal" 
  android:weightSum="1"&gt;


&lt;/LinearLayout&gt;
</code></pre>
