首页 > 其他 > 详细

TextVeiw 的 No package identifier when getting value for resource numb

时间:2015-10-04 20:48:53      阅读:258      评论:0      收藏:0      [点我收藏+]

tv_title,tv_detail,tv_comment都是TextView;

newInfo.getComment()得到的是int类型

tv_title.setText(newInfo.getTitle());
tv_detail.setText(newInfo.getDetail());
tv_comment.setText(newInfo.getComment());

这段代码会抛 No package identifier when getting value for resource numb 异常

 

原因:TextView 的setText方法把传入的int类型的值当做资源Id到项目中查询资源,而资源中却找不到相应的数值,就会报NotFoundException的错误。

解决:

1.

tv_comment.setText(String.valueOf(newInfo.getComment()));

2.

tv_comment.setText(newInfo.getComment()+"");

  

TextVeiw 的 No package identifier when getting value for resource numb

原文:http://www.cnblogs.com/zshengfei/p/4854893.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!