1

I want to access the string resource from strings.xml file within same strings.xml file.

For example:

<resources>
    <string name="app_name">Kitty App</string>
    <string name="app_welcome_title">Welcome to [here i want to access 'Kitty App' string resource that is above this line]</string>
</resources>

Is this possible? Thanks!!!

Stack Overflow
  • 1
  • 5
  • 23
  • 51

1 Answers1

-1

The answer can be found here using Entity before resource section inside strings.xml. It's not exactly that you has imagined, but it solves the question.

<?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE resources [
      <!ENTITY appname "MyAppName">
      <!ENTITY author "MrGreen">
    ]>

<resources>
    <string name="app_name">&appname;</string>
    <string name="description">The &appname; app was created by &author;</string>
</resources>

Besides, the following answer in the same reference does exactly that you think:

<string name="app_name">My App</string>
<string name="activity_title">@string/app_name</string>
<string name="message_title">@string/app_name</string>
Paulo Buchsbaum
  • 2,471
  • 26
  • 29