码迷,mamicode.com
首页 > 其他好文 > 详细

TextVeiw 的 No package identifier when getting value for resource numb

时间:2015-10-04 20:51:06      阅读:162      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!