【异常】android.content.res.Resources$NotFoundException: String resource ID #0x1
来源:互联网 发布:世纪矩阵 编辑:程序博客网 时间:2024/05/21 14:45
一般发生在参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错。
例如:
int i = 2222;tv.setText(i);
这样就会报这个异常,起初我以为setText()方法会自动将int类型的数据转换为String,其实不会。好像他把这个int类型的数据当成string.xml文件中的资源了,但是值为i的这个资源找不到,所以抛出这个异常。
解决方法:
将i转换为String再setText()。
2 0
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException:+String+resource+ID+#0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- Linux下的无名管道pipe的设计
- gen already exists but is not a source folder. Convert to a source folder or rename it.
- 查找一
- 从netstat看网络编程
- Linux下性能测试分析工具拾遗
- 【异常】android.content.res.Resources$NotFoundException: String resource ID #0x1
- Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path
- “Apache+PHP+MySQL”之win7安装Apache
- 网站为什么要生成静态页面
- 1003. 我要通过!(20)
- Linux I2C设备驱动编写(一)
- 信号
- 推荐面向对象精品课程
- hdu 3812 Sea Sky 深搜+剪枝