2016-08-13 115 views
0

在我的應用程序當我進入設置活動後,我的應用程序強制停止活動,我不知道哪個錯誤在那裏。請幫我解決這個問題。感謝您的幫助!當回到之前的意向活動時獲取錯誤

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$1 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.access$800(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$1 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.access$800(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) 

回答

0
android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState 

面前經歷了這些ClassCastExceptions,我建議你檢查你沒有一個相同的id由不同的小部件共享。另外,請查看不同佈局限定符文件夾中的佈局以獲取相同的條件。