android:错误:android.content.res.Resources$NotFoundException: String resource ID #0x1
来源:互联网 发布:真人拍照试衣软件 编辑:程序博客网 时间:2024/05/21 17:27
错误: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
- Android开发技能图谱
- scala中的尾递归和tableswitch
- 利用循环不变式写出正确的二分查找及其衍生算法
- protobuf入门
- 成功解决在Python文件上右键菜单无“Edit with IDLE”选项
- android:错误:android.content.res.Resources$NotFoundException: String resource ID #0x1
- XML和JSON的区别
- Java 注解
- MongoDB集群分片
- 顺序表应用4:元素位置互换之逆置算法
- leetcode 322. Coin Change 解题报告
- 指标的检测及检测仪器
- ubuntu14.4.04安装sublime text3
- 文章标题