问题描述
我工作的一个应用程序,而我得到weired错误。我把一些字符串资源在 RES /值/串
并保存它。现在,如果我要访问它的活动我得到这样一个错误
I'm working on an App, and I am getting weired errors. I put in some String resource in res/values/strings
and saved it. Now If I want to access it in an Activity I get an error like this
07-13 11:16:20.050: ERROR/AndroidRuntime(5883): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f060006
和我想不通为什么。资源是这样的:
And I can't figure out why.Resource looks like this:
<string name="dialog_download_text">please wait while downloading</string>
和我要访问它像
public void onCreate(Bundle b){
super.onCreate(b);
String s = getResources().getString(R.string.dialog_download_text);
}
我也看了成R.java,发现我的入门
I also looked into R.java and found my Entry
public static final class string {
public static final int dialog_download_cancel=0x7f060005;
public static final int dialog_download_text=0x7f060007;
public static final int dialog_download_title=0x7f060006;
}
我不知道该怎么办,因为我从来没有过这样的问题。请帮我。感谢所有。
I don't know what to do, because I never had a problem like this before.Please help me. Thanks all.
推荐答案
有时候,我得到这个错误(每2天一次),这是因为日食不编制新的code和它的部署老的apk。我解决这个问题通过
Sometimes I get this error (once every 2 days), and it's because eclipse is not compiling the new code and it's deploying the old apk.I fix this by
- 在做一个干净的日食(项目 - >清洁)
- 关闭模拟器
- 在运行重新启动ADB服务器
ADB杀死服务器
和亚行启动服务器
在命令行
- doing a clean on eclipse (Project -> clean)
- closing the emulator
- restarting the adb server by running
adb kill-server
andadb start-server
from the command line
这篇关于Android的,没有找到字符串资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!