获取资源的数值时,没有已知的包 [英] No known package when getting value for resource number
本文介绍了获取资源的数值时,没有已知的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一切看起来正常。但是:
没有已知的包时的资源号0x7f040001获得价值
异常抛出。
解决方案
我的code是:
资源解析度= getResources();
InputStream为= res.openRawResource(R.xml.questions);
然后我把它改为:
是= getApplicationContext()getResources()openRawResource(R.xml.questions)。
现在它工作正常:0
顺便说一句,我有另外一个问题是:
WARN / System.err的(577):$ org.apache.harmony.xml.ExpatParser ParseException的:第1行,列0:格式不正确(标记无效)
这个链接解决: Android的解析与SAXParser的
Everything looks like ok. But :
No known package when getting value for resource number 0x7f040001
exception is throwing.
解决方案
My code was:
Resources res = getResources();
InputStream is = res.openRawResource(R.xml.questions);
then I changed it to:
is = getApplicationContext().getResources().openRawResource(R.xml.questions);
Now it works correctly :o
BTW, I had another problem is:
WARN/System.err(577): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token)
This link solved: Android parsing an xml with saxparser
这篇关于获取资源的数值时,没有已知的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文