开发者

Android's strings.xml giving a nullpointer on retrieval.

开发者 https://www.devze.com 2023-04-12 14:59 出处:网络
Perhaps one of you great gods/goddesses of Android may see it fit to help a mere peasent as myself. If I use

Perhaps one of you great gods/goddesses of Android may see it fit to help a mere peasent as myself.

If I use

String myNewAppId = "34";

I am 开发者_开发技巧good. If I use

String myNewAppId = this.getString(R.string.appid);

or

String myNewAppId = getResources.getString(R.string.appid);

setting my strings.xml file to

<string name="appid">34</string>

I show no errors yet I crash with a nullpointerException.


Sometimes Eclipse does not update the string resource. Try cleaning and rebuilding your project manually to force it to be updated.

0

精彩评论

暂无评论...
验证码 换一张
取 消