Hello everyone!
I would like to know whether there is a way to insert/inject a <string>
element defined in an XML file into another <string>
element, doing that just with XML.
For example I could have:
<string name="author">Francesco</string>`
and I am looking for something like:
<string name="about_application">Author: @string/author</string>`
so that getString(R.string.about_application)
would result in "Author: Francesco".
I know that I could combine the two elements in Java code using String.format(string, formatArgs)
like for example:
<string name="author">Francesco</string>
<string name="about_application">Author: %1$s</string>`
and then in code use
String.format(getString(R.string.about_application), getString(R.string.author))
but I would like to do it in XML directly. Can anyone suggest me a way to do it?
Thank you very much.