Android报“android.content.res.Resources$NotFoundException: String resource ID xxx”错误
错误情形
使用TextView
的setText
方法,报错资源找不到。
.setText(R.id.read_num,item.getReadNum())
解决
这里item.getReadNum()
是一个int,setText
方法如果直接穿一个数字参数,会被当作是资源id,定位该资源发现找不到就会爆粗。所以只要转成字符串就可以了。
.setText(R.id.read_num, “” + item.getReadNum())