I understand the inherited structure of the LayoutParams (parent-- >child), but still I'm getting an Invalid LayoutParams error no matter what I do:
XML: <?xml version="1.0" encoding="utf-8"?> <TableLayout android:id="@+id/view_contact" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > </TableLayout> JAVA: private void populateData(AndroidContact ac) { TableLayout tl = (TableLayout)findViewById(R.id.view_contact); TableRow tr = null; TextView tv=null; if (ac.name!=null) { (tr = new TableRow(this)).setLayoutParams(tl.getLayoutParams()); (tv = new TextView(this)).setLayoutParams(tr.getLayoutParams()); tv.setText("Name: "+ac.name); tr.addView(tv); tl.addView(tv); } } I've also tried: private void populateData(AndroidContact ac) { TableLayout tl = (TableLayout)findViewById(R.id.view_contact); TableRow tr = null; TextView tv=null; if (ac.name!=null) { (tr = new TableRow(this)).setLayoutParams(new TableLayout.LayoutParams()); (tv = new TextView(this)).setLayoutParams(new TableLayout.LayoutParams()); tv.setText("Name: "+ac.name); tr.addView(tv); tl.addView(tv); } } I don't understand anymore... *sigh*. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---