title: Iterating over R.string.name
body: <p>I'm studying Java while developing a small Android Appication. I have my <code>Question</code> class defined as:</p>
  
  <pre><code>public class Question {
      private int questionId;
      private int answer;
  
      public Question (int questionId, int answer) {
          this.questionId = questionId;
          this.answer = answer;
      }
  
      [...]    //getter-setter
  
  }
  </code></pre>
  
  <p>In <code>res/values/strings.xml</code> i have:</p>
  
  <pre><code>    &lt;string name="Qst1"&gt;Question number 1&lt;/string&gt;
      &lt;string name="Qst2"&gt;Question number 2&lt;/string&gt;
      [...]
      &lt;string name="QstN"&gt;Question number N&lt;/string&gt;
      &lt;bool name="Ans1"&gt;true&lt;/bool&gt;
      &lt;bool name="Ans2"&gt;true&lt;/bool&gt;
      [...]
      &lt;bool name="AnsN"&gt;false&lt;/bool&gt;
  </code></pre>
  
  <p>Then I created a new class:</p>
  
  <pre><code>public class QuestionsList extends ArrayList {
  
      public void autofill(){
        // autofill the list with the questions
      }
  }
  </code></pre>
  
  <p>To obtain a a <code>Question</code> object, i usually call the constructor as follow:</p>
  
  <p><code>question1 = new Question(R.string.Qst1, R.bool.Ans1)</code> </p>
  
  <p><strong>I want to define the method  <code>autofill</code> in order to fill <code>QuestionsList</code> with all the questions defined in the <code>xml</code> file.</strong>
  How can I implement it?</p>