博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android.content.res.Resources$NotFoundException: String resource ID #0x11
阅读量:5368 次
发布时间:2019-06-15

本文共 2184 字,大约阅读时间需要 7 分钟。

在练习数据绑定时,出现以下错误

 FATAL EXCEPTION: main

                                                                               Process: com.vogella.android.databinding, PID: 8332
                                                                               android.content.res.Resources$NotFoundException: String resource ID #0x11
                                                                                   at android.content.res.Resources.getText(Resources.java:347)
                                                                                   at android.content.res.MiuiResources.getText(MiuiResources.java:97)
                                                                                   at android.widget.TextView.setText(TextView.java:4557)
                                                                                   at com.vogella.android.databinding.databinding.ActivityMainBinding.executeBindings(ActivityMainBinding.java:170)
                                                                                   at android.databinding.ViewDataBinding.executeBindingsInternal(ViewDataBinding.java:379)
                                                                                   at android.databinding.ViewDataBinding.executePendingBindings(ViewDataBinding.java:351)
                                                                                   at android.databinding.ViewDataBinding$6.run(ViewDataBinding.java:178)
                                                                                   at android.databinding.ViewDataBinding$5.onViewAttachedToWindow(ViewDataBinding.java:146)
                                                                                   at android.view.View.dispatchAttachedToWindow(View.java:15412)
                                                                                   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953)
                                                                                   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
                                                                                   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
                                                                                   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
                                                                                   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1561)
                                                                                   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1291)
                                                                                   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6362)
                                                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:873)
                                                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:685)
                                                                                   at android.view.Choreographer.doFrame(Choreographer.java:621)
                                                                                   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:859)
                                                                                   at android.os.Handler.handleCallback(Handler.java:754)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                   at android.os.Looper.loop(Looper.java:160)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:6200)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)

 

原因是由于数据绑定不能找到 Int类型的值。

解决办法把@{people.age}改为@{

String.valueOf(people.age)}.

转载于:https://www.cnblogs.com/halo-yang/p/7246455.html

你可能感兴趣的文章
LGPL协议的理解
查看>>
1、Python基础
查看>>
Unity The Tag Attribute Matching Rule
查看>>
试着理解下kvm
查看>>
WebService学习总结(二)--使用JDK开发WebService
查看>>
Tizen参考手机RD-210和RD-PQ
查看>>
竞价广告系统-位置拍卖理论
查看>>
策略模式 C#
查看>>
[模板]树状数组
查看>>
[HDU 6447][2018CCPC网络选拔赛 1010][YJJ's Salesman][离散化+线段树+DP]
查看>>
设计模式学习的好方法
查看>>
感谢Leslie Ma
查看>>
几种排序方法
查看>>
查看数据库各表的信息
查看>>
第一阶段测试题
查看>>
第二轮冲刺第五天
查看>>
图片压缩
查看>>
Hadoop-2.6.5安装
查看>>
ES6思维导图
查看>>
第四周作业
查看>>