异常信息:Caused By: android.content.res.Resources$NotFoundException:String resource ID #0x86 相关代码是: private TextView tv_height = null; int height = bundle.getInt("myheight"); tv_height.setText(height);//注意要转型,不然报找不到String ID 问题原因: 显示是运行时找不到一个字符串导致的异常,最后费了半天劲,发现是因为在调用setText(String str)方法时,传的是一个int型数据,未对其转为String类型,可能是Android中未实行对它的自动转型,这里可以改为: tv_height.setText(""+height); 解决此异常。
Android setText异常
最新推荐文章于 2024-08-26 22:00:55 发布