Lukap Lukap - 19 days ago 4x
Android Question

Concatenate multiple strings in XML?

I go through this How to concatenate multiple strings in android XML? and in the end there are comments that

For clarity, Its works:

<string name="title">@string/app_name</string>.
Andrzej Duś

I made my own example but it doesn't works. So does Andrzej wrong or I am doing something wrong in my code.

should contains
"bbb aaa"

but instead of
"bbb aaa"
it contains
"bbb @strings/aaa"

<string name="aaa">aaa</string>
<string name="bbb">bbb @strings/aaa</string>


Is it possible to do some concatenation only in xml, without source code changes?

Reason why I don't want to edit in code because I use this strings in

For Example:

<ListPreference android:key="key_bbb" android:title="@string/bbb"

If you know what I mean, here there is no possibility to use something like this

String title = res.getString(R.string.title, appName);


No I don't think you can concatenate.

<string name="aaa">aaa</string>
<string name="bbb">bbb @string/aaa</string>

Output - bbb @string/aaa

If you do,

<string name="aaa">aaa</string>
<string name="bbb">@string/aaa bbb</string>  -> This won't work it
                                                      will give compilation error

Because here it will search for a String with reference @string/aaa bbb which does not exists.

Problem in your case was, you where using @strings/aaa which should be @string/aaa