How to get a string from string.xml in android when constructing name at run time?
<p>In my android app, I have a number of buttons in a grid (basically a 2-D array of components). When long pressing these components I need to display a string to the user, with each array location having different strings.</p>

<p>For an actual app where I am using this, please see :<br>
RIFT Assistant : <a href="https://market.android.com/details?id=com.gopalshalu.rift.assistant" rel="nofollow">https://market.android.com/details?id=com.gopalshalu.rift.assistant</a> <br>
In the app, start up a soul tree .</p>

<h2>Question</h2>

<p>Is there a way to dynamically formulate the name of string, and get the strings value.
Something like…<br></p>

<pre><code>Int row = 0;
String target_string_name = “”;
for (int col=0;i&lt;1;i++)
{
    target_string_name  = “teststring_” + row + “_” + col; // we have dynamically created the name
    How do we get the actual string value here, using string name in target_string_name variable?
}
</code></pre>

<p>How do we get the actual string value here, using string name in target_string_name variable?
<br/><br/><br/></p>

<h1>Example</h1>

<p><strong>String to be displayed when pressing grid location (0,0)</strong> - <em>Hello, test string at 0,0</em><br>
<strong>String to be displayed when pressing grid location (0,1)</strong> - <em>World!.. test string at 0,1</em></p>

<p>I have a string.xml file, with the following naming convension:<br></p>

<pre><code>&lt;string name=’teststring_row_column’&gt;string contents&lt;/string&gt;
</code></pre>

<p>So, for the above example, the string.xml will look like:</p>

<pre><code>&lt;string name=”teststring_0_0”&gt;Hello, test string at 0,0&lt;/string&gt;
&lt;string name=”teststring_0_1”&gt;World!... test string at 0,1&lt;/string&gt;
</code></pre>

<p>Thanks in advance for your time and responses.</p>
