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

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

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

更改后就没问题了

TextView tvCredit = (TextView) view.findViewById(R.id.curri_course_item_credit);
tvCredit.setText(""+course.getCredit());
原文地址:https://www.cnblogs.com/wolf-bing/p/3280575.html