解决方法 android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
来源:互联网 发布:吃鸡游戏画面优化软件 编辑:程序博客网 时间:2024/06/06 09:51
第一次写博客 就是为了纪念这个困扰我一晚上的纠结问题 其实网上不少类似的问题 但都能看出个大概 什么LinearLayout转换 什么List转换出错 唯有这个很摸不着头脑
这里写出我的问题 很简单 Activty没有固定横竖屏 首先 手机设置了自动横竖屏 其次,从一个横屏的Activity返回时 手机还保持横屏状态 因为你没有写清楚横竖屏 所以系统会自动进行布局的适配 但你本身Activity用的默认是竖屏 这个过程我没有深究 但是问题肯定出现在这 于是就崩溃了 所以 对每个Activity强制竖屏就OK了 我把错误信息贴出来 大家可以参考下啊
03-13 21:55:17.047: E/AndroidRuntime(1586): java.lang.RuntimeException: Unable to start activity ComponentInfo{}: java.lang.ClassCastException:java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedStatead03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3371)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.ActivityThread.access$700(ActivityThread.java:130)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1167)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.os.Looper.loop(Looper.java:137)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.ActivityThread.main(ActivityThread.java:4444)
03-13 21:55:17.047: E/AndroidRuntime(1586): at java.lang.reflect.Method.invokeNative(Native Method)
03-13 21:55:17.047: E/AndroidRuntime(1586): at java.lang.reflect.Method.invoke(Method.java:511)
03-13 21:55:17.047: E/AndroidRuntime(1586): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
03-13 21:55:17.047: E/AndroidRuntime(1586): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
03-13 21:55:17.047: E/AndroidRuntime(1586): at dalvik.system.NativeStart.main(Native Method)
03-13 21:55:17.047: E/AndroidRuntime(1586): Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.widget.CompoundButton.onRestoreInstanceState(CompoundButton.java:340)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.View.dispatchRestoreInstanceState(View.java:9939)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2324)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.view.View.restoreHierarchyState(View.java:9917)
03-13 21:55:17.047: E/AndroidRuntime(1586): at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1600)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.Activity.onRestoreInstanceState(Activity.java:906)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.Activity.performRestoreInstanceState(Activity.java:878)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1100)
03-13 21:55:17.047: E/AndroidRuntime(1586): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1954)
03-13 21:55:17.047: E/AndroidRuntime(1586): ... 12 more
- 解决方法 android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
- 解决android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
- actionbar出现java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to 的解决办法
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- android.widget.HeaderViewListAdapter cannot be cast to ***
- android.widget.Button cannot be cast to android.widget.Gallery
- widget.Button cannot be cast to android.widget.ListView
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.L
- android.view.ViewGroup$LayoutParams cannot be cast to android.widget.TableRow$LayoutParams
- android.view.ViewGroup$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.R
- 1009. Product of Polynomials
- 东方通中间件TongEASY产品学习笔记
- 【绝对给力】Android开发免豆资料(教程+工具+源码)
- 学习有感
- search,search_n
- 解决方法 android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
- 阿里技术保障部电面 第一次
- 【50个最受网友欢迎的HTML5资源下载列表】
- http报头参数详解
- 【J2ME资料汇总】48个推荐资料+40个经典源码
- Assign directory/file access rights to 'everyone'
- 在线订购系统(online ordering system)开发记录
- C++中友元类
- nginx + php5-fpm 无法正常启动一则