title: forced to close on screen orientation changes
body: <p>My app is forced to close after I press "Ctrl-F11" to rotate screen. Here's the error log:   </p>
  
  <pre><code> 01-02 13:47:30.663: E/AndroidRuntime(498): FATAL EXCEPTION: main
   01-02 13:47:30.663: E/AndroidRuntime(498): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ecnu.sei.manuzhang.study/com.ecnu.sei.manuzhang.study.Main}: java.lang.ClassCastException: android.widget.ExpandableListView$SavedState
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2832)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.access$1600(ActivityThread.java:117)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.os.Handler.dispatchMessage(Handler.java:99)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.os.Looper.loop(Looper.java:130)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.main(ActivityThread.java:3683)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at java.lang.reflect.Method.invokeNative(Native Method)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at java.lang.reflect.Method.invoke(Method.java:507)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at dalvik.system.NativeStart.main(Native Method)
   01-02 13:47:30.663: E/AndroidRuntime(498): Caused by: java.lang.ClassCastException: android.widget.ExpandableListView$SavedState
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.widget.ListView.onRestoreInstanceState(ListView.java:3763)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.View.dispatchRestoreInstanceState(View.java:6278)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchThawSelfOnly(ViewGroup.java:1228)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.widget.AdapterView.dispatchRestoreInstanceState(AdapterView.java:767)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215) 
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:1215)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.view.View.restoreHierarchyState(View.java:6257)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1486)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.Activity.onRestoreInstanceState(Activity.java:844)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.TabActivity.onRestoreInstanceState(TabActivity.java:58)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.Activity.performRestoreInstanceState(Activity.java:816)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
   01-02 13:47:30.663: E/AndroidRuntime(498):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1625)
   01-02 13:47:30.663: E/AndroidRuntime(498):     ... 12 more 
  </code></pre>
  
  <p>As it shows, it has something to do with an ExpandableListView. Thus, I attach the suspected activity and its layout here:    </p>
  
  <pre><code>public class StudyHalls extends ExpanableListActivity {
  @Override 
  public void onCreate(Bundle savedInstanceState) {
      Log.d(TAG, "on create");
      super.onCreate(savedInstanceState);
      setContentView(R.layout.halls);
              ...
      }
      ...
   }
  </code></pre>
  
  <p>halls.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;ExpandableListView
      android:id="@id/android:list"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
  /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>