开发者

Android - Parsing XML resource references

I'm writing a game in Android that uses a custom XML format to describe the game levels. The level files are stored in res/xml. I want to be able to reference Android resources (e.g., @string and @drawable). Since I'm parsing the XML m开发者_开发技巧yself, I'll obviously need to do this manually. So the question is: does Android have a public API for obtaining resources this way?


You can put the name of the strings/drawables in and use Resources.getIdentifier in your code. You can access your Resources by using Context.getResources().

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜