I just started learning Android application development and I noticed the following issue while trying different activity elements. I have the following code in my Main activity
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/row1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TimePicker
android:id="@+id/timePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
Its an activity with just a TimePicker. My issue is that whenever I change the orientation of my mobile device the hour selection of the TimePicker goes blank and the following error is generated in the LogCat.
Saved cursor position 2/2 out of range for (restored) text
By default, Android restarts your Activity when you change your screen orientation or any configuration change. You will have to specify (in your AndroidManifest.xml) that you wan’t to handle the configuration change yourself. Then in your activity, override the
onConfigurationChanged()method.More info can be found here: http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange