您的位置:首页 > 产品设计 > UI/UE

TextVeiw 的 No package identifier when getting value for resource numb

2015-10-04 19:48 363 查看
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()+"");


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: