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

出现这个问题后,发现view没错,tvCredit也没错,死活不知道缘由,后来网上查到了缘由,setText()里面的参数必须是String的,而原本的course.getCredit()是int型的。spa

TextView tvCredit = (TextView) view.findViewById(R.id.curri_course_item_credit);
tvCredit.setText(course.getCredit());

更改后就没问题了code

TextView tvCredit = (TextView) view.findViewById(R.id.curri_course_item_credit);
tvCredit.setText(""+course.getCredit());
相关文章
相关标签/搜索