android.content.res.Resources$NotFoundException: String resource ID #0x11

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

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)}.

时间: 2024-12-28 18:48:36

android.content.res.Resources$NotFoundException: String resource ID #0x11的相关文章

android.content.res.Resources$NotFoundException:String resource ID #ffffffff

无语,搞了半天,只能去插这个错误代号,结果就找到了这个结果. scoreTextView.setText(score+""); 这个一定要自己手动转换..不科学啊..关键是在eclipse里的提示错误让人以为是id写错了什么的. 以下是别人的一片文章: http://www.blogjava.net/anchor110/articles/355670.html 今天跑程序的时候,出现这样的错误: android.content.res.Resources$NotFoundExcepti

bug android.content.res.Resources$NotFoundException: String resource ID #0x0

android.content.res.Resources$NotFoundException: String resource ID #0x0 找不到资源文件ID #0x0 原因分析如下: 遇到这种情况,很有可能是把一个int型业务数据的 设置setText()或者类似的方法中, 这样Android系统就会主动去资源文件当中寻找, 但是它不是一个资源文件ID, 所以就会报出这个bug. 将int型业务数据,转换成String类型即可.

异常处理android.content.res.Resources$NotFoundException: String resource ID #0x44

错误:android.content.res.Resources$NotFoundException: String resource ID #0x1 原因:一般发生在参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错. 最简单的例子,检查一下你的Toast.makeText()啊textView.setText啊之类的函数,这种函数通常有几个重载,如: textView.setText(CharSequence text);

android.content.res.Resources$NotFoundException: String resource ID #0x1

之前忘了记录这个错误,今天又遇到了.唉,人不能纵容自己犯懒,遂记录之. 错误:android.content.res.Resources$NotFoundException: String resource ID #0x1 原因:一般发生在参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错. 最简单的例子,检查一下你的Toast.makeText()啊textView.setText啊之类的函数,这种函数通常有几个重载,如:

android.content.res.Resources$NotFoundException: String resource ID XXXX

错误:android.content.res.Resources$NotFoundException: String resource ID XXXX 原因:一般发生在参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错. 最简单的例子,检查一下你的Toast.makeText()啊textView.setText啊之类的函数,这种函数通常有几个重载,如: textView.setText(CharSequence text);

异常 android.content.res.Resources$NotFoundException: String resource ID #0x61

09-09 16:08:41.554: E/Weaver(13140):09-09 16:08:41.554: E/Weaver(13140): android.content.res.Resources$NotFoundException: String resource ID #0x6109-09 16:08:41.554: E/Weaver(13140): at android.content.res.Resources.getText(Resources.java:242)09-09 1

android.content.res.Resources$NotFoundException: String resource ID #0x0

今天遇到了这个貌似很“唬人”的错误,决定记录之. 错误:android.content.res.Resources$NotFoundException: String resource ID #0x0 出现场景:在为TextView进行setText时出现. 错误原因:setText的参数是一个CharSequence,这是一个String继承的接口,如果将错int型数据写入就会引发这个错误. 类似错误:android.content.res.Resources$NotFoundExceptio

解决:Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2

在运行Android app时出现以下错误: --------- beginning of crash 11-28 07:53:56.485 6712-6712/com.trojane.android.learnactivity E/AndroidRuntime: FATAL EXCEPTION: main Process: com.trojane.android.learnactivity, PID: 6712 java.lang.RuntimeException: Unable to sta

【资源NotFoundException美元:# 0 x55字符串资源】Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x55

如果遇到这个问题,首先考虑以下原因: 你是否在setText()方法中设置了一个int型变量,比如setText(10). 这样Android系统就会主动去资源文件当中寻找, 但是它不是一个资源文件ID, 所以就会报出这个bug. 解决办法:将int型业务数据,转换成String类型即可,比如 tv_price.setText(price+"");