android.content.res.Resources$NotFoundException: String resource ID #0x1
来源:互联网 发布:spss软件及应用 编辑:程序博客网 时间:2024/05/22 04:50
错误:android.content.res.Resources$NotFoundException: String resource ID #0x1
解决办法:
如果要显示该int值,就要将int转化成String或者CharSequence,百度上很多办法。
个人比较喜欢这么干:在该int值后面+"",强制转为String。简单易用。
原因:举个例子来说明原因:
最简单的例子,检查一下你的Toast.makeText()、textView.setText啊之类的函数,这种函数通常有几个重载,如:
1.textView.setText(CharSequence text);2.textView.setText(int resId);
一般发生在textView.setText(int resId),参数 int resId 错误,你把String赋值给int的resId,所以编译器找不到正确的resource于是报错。
如果不小心将一个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
- OOOOrz_(:з」∠)_
- 关于直三棱柱,它的侧面是什么图形呢?
- C++与MFC string 相互转换
- redis操作
- Android 如何将自己的签名文件导入eclipse
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- python Django 安装
- MFC之CBitmap类的使用
- XShell上传、下载文件方法
- 关于 jdk1.7+sql server2014+myeclipse8.6 的数据库连接
- Oracle数据库中插入日期型数据
- Linux shell之eval、``与$()
- css常用技巧--文字省略(单行,多行)
- Mysql NDB and InnoDB 存储引擎区别