I created an xml file using Eclipse for an Android app that I was creating. After finishing all the layouts, and doing some coding and such, I found out that the final product needed to be on an earlier API level (10 to be exact). So I began the process of rolling back the code and the xml files, but have run into a problem that I can't solve, and doesn't seem to have any documentation. I created a table layout, and have many table rows. When I try to run the program on the virtual device, I'm given a Null Pointer Exception with regards to the TableRow.measureNullChild(int) function, the code of which is:
@Override
int measureNullChild(int childIndex) {
return mConstrainedColumnWidths[childIndex];
}
Obviously the problem is in there somewhere, but I'm not sure of the exact specifics, and was wondering if anybody else has had this problem. I'll now post the xml file that causes the crash:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/livelayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/hope" >
</RelativeLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_margin="0dp"
android:gravity="center"
android:paddingLeft="0dp"
android:paddingTop="0dp"
android:text="@string/us"
android:textSize="28dp"
android:textColor="#CC7F32" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/TextView01"
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_margin="0dp"
android:gravity="center"
android:paddingLeft="0dp"
android:paddingTop="0dp"
android:text="@string/them"
android:textSize="26dp"
android:textColor="#CC7F32" />
</FrameLayout>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:visibility="visible" >
<Button
android:id="@+id/us2"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us2" />
<Button
android:id="@+id/us2made"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us2m" />
<Button
android:id="@+id/button3"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them2" />
<Button
android:id="@+id/button4"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them2m" />
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<Button
android:id="@+id/button5"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us1" />
<Button
android:id="@+id/button6"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us1m" />
<Button
android:id="@+id/button7"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them1" />
<Button
android:id="@+id/button8"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them1m" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<Button
android:id="@+id/button9"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us3" />
<Button
android:id="@+id/button10"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us3m" />
<Button
android:id="@+id/button11"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them3" />
<Button
android:id="@+id/button12"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/them3m" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<Button
android:id="@+id/button13"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/usOreb" />
<Button
android:id="@+id/button14"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/usXreb" />
<Button
android:id="@+id/button15"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/themOreb" />
<Button
android:id="@+id/button16"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/themXreb" />
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<Button
android:id="@+id/button17"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us2f" />
<Button
android:id="@+id/button18"
android:layout_width="70dp"
android:layout_height="50dp"
android:text="@string/us2fm" />
<Button
android:id="@+id/button19"
android:layout_width="70dp"
android:layout_height="50dp"
android:padding="5dp"
android:text="@string/them2f" />
<Button
android:id="@+id/button20"
android:layout_width="70dp"
android:layout_height="50dp"
android:padding="5dp"
android:text="@string/them2fm" />
</TableRow>
<TableRow
android:id="@+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="30dp" >
</TableRow>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="60dp"
android:paddingRight="60dp" >
<Button
android:id="@+id/button21"
android:layout_width="201dp"
android:layout_height="match_parent"
android:text="Button" />
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="60dp"
android:paddingRight="60dp"
android:paddingTop = "15dp" >
<Button
android:id="@+id/Button01"
android:layout_width="201dp"
android:layout_height="match_parent"
android:text="Button" />
</FrameLayout>
</TableLayout>
Any help would be absolutely fantastic, as I've been stuck here for like two days, and haven't been able to figure out what's wrong. I'll be sure to post here if I do though so that googlers can find the answer if this happens to them. Thanks in advance
EDIT: After removing all rows but one, that contains content, I get the same error in the same spot
mConstrainedColumnWidthsis ...? And initialized when/how?mConstrainedColumnWidthsisnullwhen the method is called.layoutis called beforemeasure. Are you callinglayout(oronLayout) for the table or any of its rows explicitly?mConstrainedColumnWidthsis an array that's declared but not specifically initialized at the beginning of the class file, that's initialized using the intchildIndex. Also, I'm not callingonLayoutspecifically no