views:

116

answers:

1

Hi Is it possible to reference other strings inside of strings.xml ?

Something of the form:

<string name="string_one">My string</string>
<string name="string_two">Here it is: android:id="@string/string_one" </string>

(If it did exist, there would of course be problems of circular, infinite definitions, etc. to beware of).

Thanks.

+1  A: 

I don't think it's possible. What I usually do is the following:

<string name="string_one">My string</string>
<string name="string_two">Here it is: %s" </string>

and in the java code:

String.format(getString(R.string.string_two), getString(R.string.string_one));

I do this kind of thing for parametrize msgs like: "You have %d new mails".

Macarse
Right, but that doesn't work for instance for strings being used in layout XML files, for instance.
ChaimKut
@ChaimKut: For example?
Macarse