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 myself, I’ll obviously need to do this manually. So the question is: does Android have a public API for obtaining resources this way?
I’m writing a game in Android that uses a custom XML format to describe
Share
You can put the name of the strings/drawables in and use Resources.getIdentifier in your code. You can access your
Resourcesby usingContext.getResources().