Issue
I have a raw xml file that holds some hierarchical data in my raw folder:
<Structures>
<Structure id="first">
...
</Structure>
<Structure id="second">
...
</Structure>
<Structure id="third">
...
</Structure>
In my code i have a function that gets as a parameter a structure id (as a string) and does something.
What I would want is to have a mechanism that would generate a file (similar to the R file) that holds static inner classes with static variables that hold the string ids of the structure.
meaning that instead of:
myFunc("first");
i'd have something like:
myFunc(CustomR.structures.first);
is there something like this built in the android sdk? if not, is it possible in android? (i know that compile in run time is possible in java but still, android sdk and mobile environment is quite different)
P.S - Of course this means that if i add another structure to the xml and build my project, a new member in my CustomR class would be created.
Thanks in advance.
Solution
AFAIK, there is nothing in the Android SDK for this. You'll have to generate them at compile time.
Answered By - Mus
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.