原代码:
protected void convert(BaseViewHolder helper, Student item) {
helper.setText(R.id.item_tv_realm_num,item.getNum());
helper.setText(R.id.item_tv_realm_name,item.getName());
helper.setText(R.id.item_tv_realm_age,item.getAge());
}
在语句:
helper.setText(R.id.item_tv_realm_age,item.getAge());
报错:

原因:我的age是int类型,而setText()的括号中需要添加的数据应是String类型。
解决方法:

使得setText()的括号中添加的数据为String类型,可在获取的数据后加上“""”,两个英文的双引号,即可确保括号中为String类型。

故,修改后的代码如下:

将报错的语句修改为:

helper.setText(R.id.item_tv_realm_age,item.getAge()+"");

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

  1. (转载)android:android.content.res.Resources$NotFoundException: String resource ID #..

    android.content.res.Resources$NotFoundException: String resource ID #0x0 找不到资源文件ID #0x0 原因分析如下: 遇到这种 ...

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

    无语,搞了半天,只能去插这个错误代号,结果就找到了这个结果. scoreTextView.setText(score+""); 这个一定要自己手动转换..不科学啊..关键是在ecl ...

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

    之前忘了记录这个错误,今天又遇到了.唉,人不能纵容自己犯懒,遂记录之. 错误:android.content.res.Resources$NotFoundException: String resou ...

  4. Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误

    Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误 当调用setText()方法时 ...

  5. 异常 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.Resourc ...

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

    报错:android.content.res.Resources$NotFoundException: String resource ID #0x0 原因:在setText()中使用了int型的参数 ...

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

    仔细检查是不是在settext的时候设置进去的时int属性的值,所以android会认为这是在strings中的值,所以会拿着这个int值当做string的id值去找,结果当然是找不到的.

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

    如果遇到这个问题,首先考虑以下原因: 你是否在setText()方法中设置了一个int型变量,比如setText(10). 这样Android系统就会主动去资源文件当中寻找, 但是它不是一个资源文件I ...

  9. Android 的坑一 :android.content.res.Resources$NotFoundException: String resource ID #0x0 找不到资源文件ID #0x0

    原因分析如下: 遇到这种情况,很有可能是把一个int型业务数据的 设置setText()或者类似的方法中, 这样Android系统就会主动去资源文件当中寻找, 但是它不是一个资源文件ID, 所以就会报 ...

随机推荐

  1. MySQL(二)表的操作与简单数据操作

    六大约束:主键约束.外键约束.非空约束.唯一约束.默认约束.自动增加 1.not null非空 2.defaul默认值,用于保证该字段的默认值 ; 比如年龄:1900-10-10 3.primar k ...

  2. three.js 数学方法之Matrix4

    今天郭先生说一说three.js中的Matrix4,相较于Matrix3来说,Matrix4和three.js联系的更紧密,因为在4x4矩阵最常用的用法是作为一个变换矩阵.这使得表示三维空间中的一个点 ...

  3. Lun4R-CyBRICSCTF wp

    WEB Hunt (Web, Baby, 50 pts) 打断点,然后就一个一个被抓住了... 接着F12就出现了.(这个flag是白色的,藏在下面....)... RE Baby Rev 题目给了个 ...

  4. pandas之数值计算与统计

    数值计算与统计 对于DataFrame来说,求和.最大.最小.平均等统计方法,默认是按列进行统计,即axis = 0,如果添加参数axis = 1则会按照行进行统计. 如果存在空值,在统计时默认会忽略 ...

  5. 《Python Web开发学习实录》高清PDF版|百度网盘免费下载|Python Web开发学习实录

    <Python Web开发学习实录>高清PDF版|百度网盘免费下载|Python Web开发学习实录 提取码:9w3o 内容简介 Python是目前流行的动态脚本语言之一. 李勇,本书共1 ...

  6. Python字符串更新

    Python字符串更新:截取字符串的某一部分 和 其他字符串进行拼接. 注:可以修改字符串的值,但修改的不是内存中的值,而是创建新的字符串. 1.使用字符串常量进行更新: # 使用字符串常量 strs ...

  7. 比较两个等长的字符串,若相同,则输出Match!,若不同,则输出No Match!

    文章目录 问题 代码 运行结果 问题 比较两个等长的字符串,若相同,则输出Match!,若不同,则输出No Match! 代码 data segment str1 db 'ASDFGHJKL';字符串 ...

  8. 从键盘输入一个字符串(长度不超过30),统计字符串中非数字的个数,并将统计的结果显示在屏幕上,用EXE格式实现。

    问题 从键盘输入一个字符串(长度不超过30),统计字符串中非数字的个数,并将统计的结果显示在屏幕上,用EXE格式实现. 源程序 data segment hintinput db "plea ...

  9. PHP imagecolorclosest - 取得与指定的颜色最接近的颜色的索引值

    imagecolorclosest — 取得与指定的颜色最接近的颜色的索引值.高佣联盟 www.cgewang.com 语法 int imagecolorclosest ( resource $ima ...

  10. PHP imagearc - 画椭圆弧

    imagearc — 用于画椭圆弧.高佣联盟 www.cgewang.com 语法 bool imagearc ( resource $image , int $cx , int $cy , int ...