安卓中getString(R.string.x)报android.content.res.Resources$NotFoundException: String resource ID#0x7f070
来源:互联网 发布:本地同步软件 编辑:程序博客网 时间:2024/06/15 10:49
在Activity的onCreate()函数中,执行了如下操作:
String stringPose = this.getResources().getString(R.string.pose);
在真机中执行时没有遇到任何问题,但是在虚拟机中测试的时候报出了标题的错误,具体信息为:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.orbbec.obcolor/orbbec.com.obcolor.MultiStreamActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x7f070058
然后程序停止运行
也就是说系统不能从strings.xml中获得pose字符串,为什么在真机中可以呢?
从上图可以看出,虚拟机的语言系统是英文,然而真机的语言系统是中文。
我们知道为了实现国际化,每一种语言都有对应的一个values文件夹,文件夹下面有自己的strings.xml文件。默然英文是英文的,文件夹为values;中文是values-zh。
然后去看了对应文件夹下的strings.xml文件,果然是这样,英文的strings.xml文件中没有pose字符串。
直接添加上在运行程序就OK了。
阅读全文
0 0
- 安卓中getString(R.string.x)报android.content.res.Resources$NotFoundException: String resource ID#0x7f070
- android.content.res.Resources$NotFoundException: String resource ID #0x6d
- android.content.res.Resources$NotFoundException:String resource ID #0x86
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x0
- android.content.res.Resources$NotFoundException: String resource ID #0x0
- android.content.res.Resources$NotFoundException: String resource ID #0x7f050016
- android.content.res.Resources$NotFoundException:String resource ID #0x86
- android.content.res.Resources$NotFoundException:String resource ID #0x446
- 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 #0x42
- android.content.res.Resources$NotFoundException: String resource ID #0x0
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x0
- android.content.res.Resources$NotFoundException: String resource ID #0x1
- android.content.res.Resources$NotFoundException: String resource ID #0x3
- 梯度下降综述
- ADB通过WIFI连接Android设备
- AMOS分析技术(导航页)
- 操作符小节
- 下重命名文件或文件夹(mv命令与rename命令)
- 安卓中getString(R.string.x)报android.content.res.Resources$NotFoundException: String resource ID#0x7f070
- 和菜鸟一起学android4.0.3源码之硬件gps简单移植
- 在Windows8.1下安装ubuntu双系统
- 机器学习开源算法库
- 高性能Mysql主从架构的复制原理及配置详解
- Linux Crontab 安装使用详细说明
- js event事件
- AngularJS(二)
- 经验总结-谈谈我对LayoutInflater中inflate方法的认识