返回上一个 activity 意图时出错

Get error when back to the previous activity in intent

在我的应用程序中,当我进入设置 activity 然后返回时,我的应用程序强制停止 activity,我不知道是哪个错误 there.Please 帮助我解决那个。提前感谢您的帮助!

08-13 11:36:36.355 21968-21968/com.example.user.dictationapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.user.dictationapp, PID: 21968
                                                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.dictationapp/com.example.user.dictationapp.DictationVocab}: java.lang.ClassCastException: android.view.AbsSavedState cannot be cast to android.widget.CompoundButton$SavedState
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
                                                                               at android.app.ActivityThread.access0(ActivityThread.java:139)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:136)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5103)
                                                                               at java.lang.reflect.Method.invokeNative(Native Method)
                                                                               at java.lang.reflect.Method.invoke(Method.java:515)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
                                                                               at dalvik.system.NativeStart.main(Native Method)
                                                                            Caused by: java.lang.ClassCastException: android.view.AbsSavedState cannot be cast to android.widget.CompoundButton$SavedState
                                                                               at android.widget.CompoundButton.onRestoreInstanceState(CompoundButton.java:378)
                                                                               at android.view.View.dispatchRestoreInstanceState(View.java:12842)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2658)
                                                                               at android.view.View.restoreHierarchyState(View.java:12820)
                                                                               at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1874)
                                                                               at android.app.Activity.onRestoreInstanceState(Activity.java:949)
                                                                               at android.app.Activity.performRestoreInstanceState(Activity.java:921)
                                                                               at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252) 
                                                                               at android.app.ActivityThread.access0(ActivityThread.java:139) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:136) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5103) 
                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606) 
                                                                               at dalvik.system.NativeStart.main(Native Method) 
android.view.AbsSavedState cannot be cast to android.widget.CompoundButton$SavedState

在经历过这些 ClassCastExceptions 之前,我建议您检查您是否有相同的 id 被不同的小部件共享。此外,检查不同布局限定符文件夹中的布局是否具有相同的条件。