android.content.res.Resources$NotFoundException: String resource ID #0x1
来源:互联网 发布:python 2.7安装 编辑:程序博客网 时间:2024/04/29 23:12
原文地址:点击打开链接
错误:android.content.res.Resources$NotFoundException: String resource ID #0x1
原因:一般发生在参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错。
最简单的例子,检查一下你的Toast.makeText()啊textView.setText啊之类的函数,这种函数通常有几个重载,如:
textView.setText(CharSequence text);
textView.setText(int resId);
......
如果不小心将一个int值传给了它,那它不会显示该int值,而是跑到工程下去找一个对应的resource的id,当然是找不到的,于是就报错啦。
解决办法:
如果要显示该int值,就要将int转化成String或者CharSequence,百度上很多办法。
个人比较喜欢这么干:在该int值后面+"",强制转为String。
0 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
- 补码
- Activity和Fragment的五种交互方式(Activity可以改变Fragment的UI,Fragment也可以改变ActivityUI)
- Ural1924(模拟+贪心)
- iOS App设置icon,启动图,App名称的方法
- java中特殊的String类型
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- Android实战技巧之十四:混淆与反编译
- 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数【while循环】
- runtime动态添加属性
- shell十三问之10:&& 与 || 差在哪?
- 淘宝 第三方应用安全规范
- Spring 浅谈
- hdu 3401 Trade (单调队列优化)
- Android input keyevent