Hmmm, I copied your code and it ran fine. Double check things, make
sure you're using 1.0r1. If you were building this project under
previous SDKs, try cleaning your project and rebuilding.

Cheers,
Justin
Android Team @ Google

On Oct 21, 5:38 am, "for android" <[EMAIL PROTECTED]> wrote:
>             I need to create a layout in whch has table and inside that a
> single row which has a list .I tried the following code and got a class cast
> exception.CAn any one help?
>
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):
> java.lang.ClassCastException: android.widget.TableLayout$LayoutParams
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.widget.FrameLayout.onLayout(FrameLayout.java:249)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.view.View.layout(View.java:5637)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.widget.LinearLayout.layoutVertical(LinearLayout.java:999)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.widget.LinearLayout.onLayout(LinearLayout.java:920)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.view.View.layout(View.java:5637)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.widget.FrameLayout.onLayout(FrameLayout.java:294)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.view.View.layout(View.java:5637)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.view.ViewRoot.performTraversals(ViewRoot.java:771)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1103)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.os.Handler.dispatchMessage(Handler.java:88)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.os.Looper.loop(Looper.java:123)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> android.app.ActivityThread.main(ActivityThread.java:3742)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> java.lang.reflect.Method.invoke(Method.java:515)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> 10-21 17:40:42.426: ERROR/AndroidRuntime(5757):     at
> dalvik.system.NativeStart.main(Native Method)
>
>    * main.xml*
>
>     <?xml version="1.0" encoding="utf-8"?>
>              <TableLayout android:id="@+id/tableLayout"
>                       android:layout_width="fill_parent"
> android:layout_height="fill_parent"
>                       
> xmlns:android="http://schemas.android.com/apk/res/android";
>                       android:orientation="vertical">
>                <TableRow android:id="@+id/tableRow"
>                     android:layout_width="fill_parent"
>                     android:layout_height="wrap_content"
>                     xmlns:android="http://schemas.android.com/apk/res/android";
>                    android:orientation="horizontal">
>
>              <LinearLayout android:id="@+id/linearLayout"
>              android:layout_width="wrap_content"
>             android:layout_height="wrap_content"
>              xmlns:android="http://schemas.android.com/apk/res/android";
>              android:orientation="vertical">
>             <ListView android:id="@id/android:list"
>                    android:layout_width="fill_parent"
>                   android:layout_height="fill_parent">
>              </ListView>
>           </LinearLayout>
>       </TableRow>
>     </TableLayout>
>
> *             Activity Class*
>             setContentView(R.layout.main);
>             tableLayout = (TableLayout) findViewById(R.id.tableLayout);
>             TableLayout.LayoutParams params = new
> TableLayout.LayoutParams();
>             params.setMargins(25, 20, 20, 25);
>
>             tableLayout.setLayoutParams(params);
>             setListAdapter(new ArrayAdapter<String>(this,
>                     android.R.layout.simple_list_item_1, listofRingers));
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to