SharedPreferences java.lang.RuntimeException: Unable to resume activity {com.kingnet.gamecent
来源:互联网 发布:软件测试个人简历范文 编辑:程序博客网 时间:2024/06/10 13:09
在调试SharedPreferences的代码中,有时候会将原先存储的string类型转换成其他类型,这个时候就会报错:
STACK_TRACE=java.lang.RuntimeException: Unable to resume activity {com.kingnet.gamecenter/com.kingnet.gamecenter.activity.SettingActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2790) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2819) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2266) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:261) at com.kingnet.gamecenter.store.SharedStore.getBoolean(SharedStore.java:178)这个时候应该卸载掉你的程序,然后重新运行就可以了。
原因:
调试程序的时候,程序仅仅是重复安装,没有清空程序原先的存储,就是说SharedPreferences 里面存储的还是你原来的值,现在你要修改为新的类型,这样就出现了这个异常
0 0
- SharedPreferences java.lang.RuntimeException: Unable to resume activity {com.kingnet.gamecent
- java.lang.RuntimeException: Unable to resume activity {com.android.providers.downloads.ui/com.androi
- 主activity报空指针异常java.lang.RuntimeException: Unable to resume activity
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.clm.activity/com.clm.activity
- java.lang.RuntimeException: Unable to instantiate activity
- java.lang.RuntimeException: Unable to destroy activity
- java.lang.RuntimeException: Unable to destroy activity
- java.lang.RuntimeException: Unable to start activity ComponentInfo{ com.xuqinjun.hello01/com.xuqinj
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gaobo.e5community/com.g
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.irun/com.exampl
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.gditc.mmms/com.gditc.mm
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wwj.toggle/com.wwj.toggle.Set
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstView/com.example
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.w/com.example.w.MainA
- java.lang.RuntimeException:Unable to start activity ComponentInfo{com.meizu.beautify/com.my.viewc.Ma
- java.lang.RuntimeException: Unable to stop activity {com.borqs.musicdemo/com.borqs.musicdemo.MainAct
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.xiaoshuo01/com.exampl
- java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.yf.huiju/com.yf.huiju.a
- jvm 关于初始化时<cinit> , <init>的调用。
- 浏览器兼容模式页面错乱 兼容模式和急速模式
- GIT 工具如何入门使用---我手把手教你windows环境下的git使用
- fragment使用
- c++智能指针
- SharedPreferences java.lang.RuntimeException: Unable to resume activity {com.kingnet.gamecent
- printf("和老婆相识 %d 天了!!\n",days);
- Http协议
- 中国人自己做的OS
- 数据库表结构设计方法及原则
- Shell经典日志框架
- Windows下sublime 2安装各种插件
- Java Selenium起步
- 抽象类和接口的区别