Android Resources$NotFoundException: String resource ID #0x1

今天写一个新界面,需要从其他界面通过intent传来参数,就先拿到之后通过TextView的setText显示来看看传参是否正确,写法:TextView.setText(arg) (arg是int型),然后就玩命报错 “android.content.res.Resources$NotFoundException: String resource ID #0x1”,一直不知道怎么回事,看过API才明白当调用setText()方法时如果传入int型是不会被当成内容而是resourceID来使用!R文件里当然不会有我的参数,所以报错!解决方法:TextView.setText(“” + arg)

Android Resources$NotFoundException: String resource ID #0x1

https://rucer.cn/2015-06/android-resourcesnotfoundexception-string-resource-id-0x1/

作者

Ferris Tien

发布于

2015-06-01

更新于

2024-05-15

许可协议