Issue
I am still new to android and there is probably an obvious answer to my problem. But I have not found the correct question to ask or google for.
What I want to do is read in a xml representation of a (list of) java object(s) and have the objects accessible from my activity.
Is this possible with android resources? After some reading through the internets the best solution I found was to write the objects as json string and save them in res/values. And then use something like Gson to parse them as java objects.
But there has to be a better way. What would be the standard way to approach this?
To add some context: I am programming a small android game and would like to have a research-tree. Each research item has properties like a name, costs, effects and of course a list of references to other research items as preconditions.
I would appreciate any ideas and suggestions.
Solution
If you don't want to use 3rd party solutions, the recommended way is to use the platform's XmlPullParser
:
https://developer.android.com/training/basics/network-ops/xml.html
Answered By - WindRider
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.