Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误 Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误

Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误

 原文链接: https://www.cnblogs.com/yejiurui/p/6814568.html

Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误

当调用setText()方法时如果传入int型是不会被当成内容而是resourceID来使用!

所以报错!

解决方法:TextView.setText("" + arg)

转为String传入即可

Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误

当调用setText()方法时如果传入int型是不会被当成内容而是resourceID来使用!

所以报错!

解决方法:TextView.setText("" + arg)

转为String传入即可

猜你喜欢

转载自www.cnblogs.com/liyanli-mu640065/p/9025347.html