tablelayout gives error in scrollview
<p>i am trying to create tablelayout inside scrollview but it gives me erorr 
 i have multiple tablelayout on screen whichi is fill dynamically using imageview
 here i put my logcat error </p>

<pre><code>Logcat error

05-07 15:36:33.193: E/AndroidRuntime(681): java.lang.ClassCastException: android.widget.TableLayout$LayoutParams
</code></pre>

<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="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" &gt;
       &lt;ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
        &gt;
     &lt;TableLayout  android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                  android:id="@+id/itable"&gt;
        &lt;TableRow
                 android:id="@+id/trstate"
                 android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
         &gt;
        &lt;TextView
        android:id="@+id/tstate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="NewYork"
        android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
          &lt;/TableRow&gt;
        &lt;TableRow
                 android:id="@+id/trimage"
                 android:layout_height="wrap_content"
                  android:layout_width="wrap_content"
                &gt;
        &lt;ImageView  
                 android:id="@+id/iimage"
         android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                         /&gt;

        &lt;/TableRow&gt;

    &lt;/TableLayout&gt;

       &lt;/ScrollView&gt;

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

<p>TableActivity.java</p>

<pre><code>    package com.table.image;

     import java.io.BufferedInputStream;
     import java.io.InputStream;
     import java.net.URL;
     import java.net.URLConnection;
     import android.app.Activity;
     import android.content.Context;
     import android.graphics.Bitmap;
     import android.graphics.BitmapFactory;
       import android.os.Bundle;
    import android.util.Log;
    import android.view.Gravity;
     import android.widget.ImageView;
     import android.view.ViewGroup;
    import android.widget.TableLayout;
   import android.widget.TableLayout.LayoutParams;
   import android.widget.TableRow;
import android.widget.TextView;

public class TableLayoutActivity extends Activity {
    /** Called when the activity is first created. */

    public TableLayout itable;
    public TableRow trimage;
    public TableRow trstate;
    public ImageView iimage;
    public TextView tstate;



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


        itable = (TableLayout)findViewById(R.id.itable);
        itable.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));

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

            trstate = new TableRow(this);
            trstate.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                    LayoutParams.WRAP_CONTENT));

            tstate = new TextView(this);
            tstate.setLayoutParams(new TableRow.LayoutParams(50,50));
            tstate.setText("NewYork");
            trstate.addView(tstate);



            trimage = new TableRow(this);
            trimage.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                    LayoutParams.WRAP_CONTENT));
            for (int j = 0; j &lt; 3; j++)
            {   
                Log.i("Test",Integer.toString(i) + "-" + Integer.toString(j));
                iimage = new ImageView(this);
                iimage.setPadding(8,8,8,8);
                iimage.setLayoutParams(new TableRow.LayoutParams(100,100));
                iimage.setImageResource(R.drawable.abc);
                trimage.addView(iimage);
             }            
            itable.addView(trimage);
            itable.addView(trstate);

        }

    }
}
</code></pre>
