Reputation: 41
This is what I want to do, in standard way.
<string name="foo">foo</string>
<string name="foo_bar">foo bar</string>
Can I rewrite like below?
<string name="foo">foo</string>
<string name="foo_bar">@string/foo bar</string>
I know this is not in schema, however, it is OK like below,
<string name="foo">foo</string>
<string name="altfoo">@string/foo</string>
Why!?
Upvotes: 4
Views: 2035
Reputation: 133560
This
<string name="foo">foo</string>
<string name="foo_bar">@string/foo bar</string>
wrong coz there is no resource with the name foo bar
The above would be right if you had
<string name="foo bar">foo and bar</string>
<string name="foo_bar">@string/foo bar</string>
This
<string name="foo">foo</string>
<string name="altfoo">@string/foo</string>
is right coz there is a resource with name foo and you are referencing the same
You may want to check
Concatenate Strings in the strings.xml file for Android
Upvotes: 2