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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pbm863521/article/details/82630111

运行出现上述异常。贴上异常部分的代码:

viewHolder.tvAssortment.setText(list.get(position).getAssortment());

其中tvAssortment是TextView类型,list.get(position).getAssortment()是int类型。

setText设置的是String类型。由于类型不一致,所以出现了上述异常。需要把int类型转为String类型。

把list.get(position).getAssortment()改为list.get(position).getAssortment()+“”,问题解决。

猜你喜欢

转载自blog.csdn.net/pbm863521/article/details/82630111