I got the following problem: In my Android App I am using a table to show some information. This information also contains 2 boolean values which are displayed as a checkbox. When the table is loaded the checkboxes work as they should but as soon as I change the interface orientation both checkboxes get checked even if the data values are false.
The table is defined like this:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/table_properties"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffffff"
/>
And a single boolean row in that table:
<TableRow
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text_jobprop_name"
style="@style/text_list_black"
android:layout_height="fill_parent"
android:textSize="12dp"
android:padding="3dp"
android:singleLine="false"
android:gravity="center_vertical"
android:background="@color/table_property_name_background"
android:layout_weight="0.7"
android:layout_width="0dp"
/>
<LinearLayout
android:layout_height="wrap_content"
android:gravity="left"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:layout_width="0dp"
android:background="@color/white">
<CheckBox
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/chckbox_jobprop_value"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:clickable="false"
android:layout_marginLeft="10dp"
/>
</LinearLayout>
</TableRow>
And in the onCreate method of the activity I call a function that sets all the values for the table. I know that this function is called everytime I change the interface orientation but I debugged it and the data values do not change.
Any hints, ideas, whatever?
Thanks.
That’s true but try putting the setting of the checkboxes in the onResume method… If not: when is your super.onCreate called?