Android variables in strings.xml
android, parsing, variables, xml
Solution
This will solve your problem:
<resources>
<string name="some_string">string1</string>
<string name="another_string">@string/some_string trolololo</string>
</resources>
Now the output of the `getApplicationContext().getString(R.strings.another_string)` will be `string1 trolololo`.
Problem
Somewhere I read how to use variables in XML document. They said it's very simple and I guess it was. I successfully used it that way in Android strings.xml file. I was using it that way the whole day until suddenly android stopped to parse it and stopped to treat it like a variable. I used it in this way: ``` <resources> <string name="some_string">string1</string> <string name="another_string"> {$some_string} trolololo </string> </resources> ``` and in java accessing it through: getApplicationContext().getString(R.strings.another_string); ``` getApplicationContext().getString(R.strings.another_string); ``` In the output I used to receive string like: ``` string1 trolololo ``` and now I receive only: ``` {$some_string} trolololo ``` Does anyone have any idea what is wrong? I know that Android's XML may differ than standard XML, but IT USED TO WORK. Awww... Thanks for any advice.