1.android.content.res.Resources$NotFoundException: String resource ID #0x4
- 会出现在需要
String数据的地方传入int的时候遇到。
比如:
TextView title = (TextView) convertView.findViewById(R.id.question_paper_pop_type);
TextView realScore = (TextView) convertView.findViewById(R.id.question_paper_pop_realscore);
title.setText(item.getName());
realScore.setText(item.getRealScore()+"");//*这里*
title是需要String,所以没有问题。realScore需要的是String类型,然而item.getRealScore()是int所以会出错,因此修改为item.getRealScore()+""就没有问题。
java.lang.OutOfMemoryError
一般是在显示bitmap的时候产生。
本文探讨了Android开发中常见的两种错误:Resources$NotFoundException与OutOfMemoryError。前者通常发生在使用错误的数据类型转换时,例如将int类型直接赋值给需要String类型的控件;后者则常见于Bitmap图片加载过程中,文章提供了StackOverflow上的解决方案。
1464

被折叠的 条评论
为什么被折叠?



